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 2000 Forums
 Transact-SQL (2000)
 Assigning variables values

Author  Topic 

sql_wedge
Starting Member

18 Posts

Posted - 2005-08-11 : 10:15:32
Hi

I know if you declare a variable you can then assign it a value by using th 'SET @variablename =' command, but is there a way in which you can assign multiple variables values from a select query

eg. select into @variable1,@variable2 from select variable1,variable2 from tablename

thanks
I hope i made myself clear

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-08-11 : 10:18:21
select @variable1 = variable1, @variable2 = variable2 from tablename

this however will set the variables to last to values of the set if the set has more than 1 row returned.

Go with the flow & have fun! Else fight the flow
Go to Top of Page

sql_wedge
Starting Member

18 Posts

Posted - 2005-08-11 : 10:28:31
Thanks
Go to Top of Page
   

- Advertisement -