Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which of the following is the fastest at variable assignment 1

Status
Not open for further replies.

StoneDeCroze

Programmer
Feb 11, 2002
36
GB
Hi All,
Got a fairly long procedure that I am trying to speed up in anyway possible. Can any one tell me which is faster out of the following:

SET @Variable = 0
SELECT @Variable = 0

I reckon it's the first one, but I would like to know for sure.

Thanks
Peter
 
No difference in speed, only that you can assign more than one variable at a time with SELECT:

Code:
SELECT @var1 = 1, @var2 = 2, @var3 = 3 ...

Can only assign one at a time with SET.

--James
 
I learned from another expert who told me it's better to use "select" instead of "set".

But not all the condition you can use select,sometimes it keeps on prompting syntax error.Usually I go for set only when it's complicated enough and I dont want to fix a syntax error for select.

 
Thanks for you prompt replies.
Guess I can't speed up my procedure that way then!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top