Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Which one is faster

Author  Topic 

pmotewar
Yak Posting Veteran

62 Posts

Posted - 2009-05-09 : 03:14:22
Hi All,

Which statement is faster when we think for performance.

set @abc = 'pankaj'

or

select @abc='pankaj'




Pankaj

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-05-09 : 03:16:59
This has been tested numerous times before, and it seem that for a single variable SET is faster, but SELECT is faster for two or more variables.
But remember the difference is measured in nanoseconds.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

pmotewar
Yak Posting Veteran

62 Posts

Posted - 2009-05-09 : 03:35:11
quote:
Originally posted by Peso

This has been tested numerous times before, and it seem that for a single variable SET is faster, but SELECT is faster for two or more variables.
But remember the difference is measured in nanoseconds.

E 12°55'05.63"
N 56°04'39.26"




Thanks for replay.

Pankaj
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-05-09 : 04:35:39
http://vyaskn.tripod.com/differences_between_set_and_select.htm

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -