Wednesday, March 21, 2012

Diff Between Select & Set

Hi,
I am having a simple question.
Select @.test = 'test'
Set @.test = 'test'
Can anyone give me the difference between the above
two statements..
Selva
:)Effectively there is no difference. Either will assign the variable a value. Personally, I prefer to use SET whenever I'm just assigning one variable a value and use SELECT when I'm returning a resultset.|||not a lot.

you can only set one variable with set but can set multiple ones with select and have to use a subquery to get a value from a table with set but I think set has less overhead.

No comments:

Post a Comment