February 15, 2004 at 2:23 pm
Comments posted to this topic are about the content posted at http://vyaskn.tripod.com/differences_between_set_and_select.htm
Brian Knight
Free SQL Server Training Webinars
February 16, 2004 at 3:36 pm
I hope you are refering to the usage of these commands with variables.
The SET command is generally used when you have a know fixed value that you want to assign to a variable.
If you want to set up the variable dynamically or you want to set the variable with a value derived with a SQL querry you use select clause.
Eg.
Use Northwind
Declare @name sysname
-- Set value
Set @name = 'Region'
--Select
Select @name = name from sysobjects where id = '885578193'
Both the statements will set the name to Region
Thanks
February 17, 2004 at 7:50 am
I'm kinda pulling this from the memory banks, but here goes.
SQL Server 4.2 and 6.5 were based on Sybase code (I think).
Sql Server 7.0 was the first all Microsoft version.
I think SET and SELECT were for backwards compatiability.
I ?think SET was the sybase one.
Well, maybe that'll get you started if you really want to know.
I think I use SELECT now. Because of the "@" symbol, you always know whether you're setting a variable, or running a query.
..
February 17, 2004 at 8:39 am
I also believe that the an assignment select entails the creation of a resultset vs. using the set statement.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply