Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Check if PK value is in table
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01076415
Message ID:
01076431
Vues:
20
Sergey,
That conflicts with the rule-of-thumb: "Never use * when selecting, always specify the fields".
I know you are a very smart man, so I am wondering why you would do this.
Does it change performance or just reduce typing?

Einar

>I use '*' in subquery because the field list is irrelevant in this case.
>
IF NOT EXISTS(SELECT * FROM [MyTable] WHERE [PK] = @PK) ...
>
>
>
>>>
>>>
IF NOT EXISTS(SELECT [PK] FROM [MyTable] WHERE [PK] = @PK) ...
>>>
>>>If this query is used a lot, there should be a nonclustered index on PK.
>>
>>Thanks. Your way looks cleaner than my code.
>>
>>
Semper ubi sub ubi.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform