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
 General SQL Server Forums
 New to SQL Server Programming
 DECLARE and SELECT

Author  Topic 

azeemigi
Starting Member

5 Posts

Posted - 2010-01-15 : 07:57:37
SELECT Temp_ID FROM tblTemp --Assume Temp_ID is an integer
DECLARE @TempID as int


How can I assign Temp_ID into @TempID??? Do I need to use SELECT statement????


Regards
Sequel Noob

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-01-15 : 07:59:32
DECLARE @TempID as int
SELECT @TempID = Temp_ID FROM tblTemp

But if there are more than one Temp_ID, only the last value would be assigned


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

azeemigi
Starting Member

5 Posts

Posted - 2010-01-15 : 08:57:50
Thank you... That works..

Regards
Sequel Noob
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-01-15 : 09:02:02
quote:
Originally posted by azeemigi

Thank you... That works..

Regards
Sequel Noob


You are welcome

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -