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 2005 Forums
 .NET Inside SQL Server (2005)
 Set parameter

Author  Topic 

stroek
Starting Member

18 Posts

Posted - 2008-08-07 : 07:54:06
What is the correct way to do next:

DECLARE @CheckID INT
@CheckID = select * from TableA

select * from TableB where ID = @CheckID

Tks

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-08-07 : 08:22:02
quote:
Originally posted by stroek

What is the correct way to do next:

DECLARE @CheckID INT
@CheckID = select * from TableA

select * from TableB where ID = @CheckID

Tks


DECLARE @CheckID INT
SELECT @CheckID = ID from TableA

select * from TableB where ID = @CheckID


Madhivanan

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

stroek
Starting Member

18 Posts

Posted - 2008-08-07 : 09:01:02
tks
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-08-07 : 09:04:39
Note that if you have many ids in tableA, only last returned id would be stored in the varialbe @CheckID

Madhivanan

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

- Advertisement -