posted on Friday, September 24, 2004 11:40 AM by Harpua

TSQL Optimization

Saw this in CODE magazine. Maybe this is common knowledge, but want to make sure I don't forget it.
Appears that that using multiple SET statments to setup variables like:
SET @foo1 = 0
SET @foo2 = 0
SET @foo3 = 0
...


is slower than one SELECT like:


SELECT @foo1 = 0, @foo2 = 0, @foo3 = 0


makes sense once you understand that behind the scenes each SET statement is converted to an individual SELECT statement.

Great article, but that tidbit makes it well worth reading

Comments