Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
This query is slow
Message
De
15/10/2004 13:20:26
 
 
À
15/10/2004 11:34:34
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00951748
Message ID:
00951773
Vues:
12
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform