|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
selecting just a column from a resultset returned by an SPcan i do something like this:
SELECT BidID FROM (EXEC BidAccessRetrieve @BidID = 30, @LevelID = 6) where BidAccessRetrieve is an SP which returns a resultset? I just want to reuse the said SP to obtain the list of BidIDs which I will use in an IN clause of another SP, I hope I am making sense here... Hi
No use insert into <temptable> and select from there. or use function where you can select asif from view or return table from sp Regards R.D Show quote "joeycalisay" wrote: > can i do something like this: > > SELECT BidID FROM (EXEC BidAccessRetrieve @BidID = 30, @LevelID = 6) > > where BidAccessRetrieve is an SP which returns a resultset? I just > want to reuse the said SP to obtain the list of BidIDs which I will use > in an IN clause of another SP, I hope I am making sense here... > > CREATE TABLE #BidAccessRetrieve (bidid INTEGER, ...)
INSERT INTO #BidAccessRetrieve (bidid, ...) EXEC BidAccessRetrieve @BidID = 30, @LevelID = 6 SELECT ... FROM ... WHERE bidid IN (SELECT bidid FROM #BidAccessRetrieve) DROP TABLE #BidAccessRetrieve -- David Portas SQL Server MVP -- |
|||||||||||||||||||||||