>I have a table called testtable. In this table have column flag with bit data type.
>When I run this query. it very slow.
>
>select * from testtable where flag=0
>
>
>How can I improve this?
>
>
>Thanks
>
>
>Jim
You have to set a index for flag, but SQL don't allow index for bit datatype.
1. define a computed field like flagOnIndex = CAST(flag AS TINYINT)
2. define a index for flagOnIndex
3. use
select * from testtable where flagOnIndex =0