In a stored procedure I am selecting "top 1" out of a table that has several
columns. I would like to take the vaues from the columns I have retrieved
and set them to some variables I have. How do I perform this?Hi,
SELECT @.SomeVar = SomeColumnName
>From SomeTable
HTH, jens Suessmeyer.
http://www.sqlserver2005.de
--|||declare @.a int, @.b int
select top 1 @.a = col1, @.b = col2 from table1|||Try:
select top 1
@.var1 = Col1
, @.var2 = Col2
from
MyTable
order by
Col3
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
"JT" <x@.microsoft.com> wrote in message
news:Op0S78yVGHA.5012@.TK2MSFTNGP10.phx.gbl...
In a stored procedure I am selecting "top 1" out of a table that has several
columns. I would like to take the vaues from the columns I have retrieved
and set them to some variables I have. How do I perform this?|||Thanks
"Omnibuzz" <Omnibuzz@.discussions.microsoft.com> wrote in message
news:109F7675-90EC-489C-8855-6963284E0A80@.microsoft.com...
> declare @.a int, @.b int
> select top 1 @.a = col1, @.b = col2 from table1
>
No comments:
Post a Comment