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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-03-05 : 00:39:49
|
Tim writes "Is it possible to pass the results of one select statement to another as the select paramater. Something like:
SELECT @selectstr AS Attribute FROM Table1 WHERE UserID = 123
SELECT @selectstr FROM Table2 WHERE AttributeID = 456
The problem seems to stem from the fact the the first SQL statement returns null values when I try and PRINT @selectstr. The dynamically generated SELECT parameter is also likely to contain multiple values. I've tried nested selects and joins but this refused to work. Joins are unsuitable as I don't know at which columns I need prior to runtime.
I'm using SQL Server 2000 and Windows 2000 Server.
Many thanks Tim" |
|
|
|
|
|