Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Check if PK value is in table
Message
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01076415
Message ID:
01365807
Views:
31
See Re: Which statement is 'Better' Thread #1048319 Message #1335280

>Thanks for the answer Sergey.
>
>>An EXISTS subquery doesn't return any data so there's no reason to list any columns in it.
>>
>>>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 it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform