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)
 How can I assign the select statement output to variable

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-11-13 : 10:01:48
erkan writes "How can I assign the select statement output to variable."

Crespo

85 Posts

Posted - 2002-11-13 : 10:21:54
How about something like this,

DECLARE @the_date DATETIME

SET @the_date = (SELECT getdate())

Best Regards.

Crespo.
Hewitt Bacon & Woodrow
Epsom
Surrey
United Kingdom
Go to Top of Page

Andraax
Aged Yak Warrior

790 Posts

Posted - 2002-11-13 : 10:22:43
If you mean for one or more single values (example):

declare @var int, @var2 float

select @var=field1, @var2=field3
from table1
where field2=7

Go to Top of Page
   

- Advertisement -