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 via a SELECT

Author  Topic 

HoopsBhoy
Starting Member

4 Posts

Posted - 2007-02-19 : 11:23:15
Hi,

I have 4 variables I wish to assign from one select statement i.e.

declare @name as varchar(50)
declare @id as uniqueidentifier
declare @dob as datetime
declare @age as int

select name,id,dob,age from user


How do I go about doing this?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-19 : 11:27:49
[code]SELECT @Name = Name,
@ID = ID,
@DoB = DoB,
@Age = Age
FROM User
WHERE SSN = '230930249234'[/code]

Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -