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)
 use sp in query

Author  Topic 

henrikop
Constraint Violating Yak Guru

280 Posts

Posted - 2004-10-27 : 04:37:31
Somehow I use the wrong keywords to search. I forgot how to use a recordset from a stored procedure in a select statement.

SELECT Customer FROM Table1 t1
JOIN (EXEC sp1 'SomeParameter') s1 ON s1.uid = t1.uid

I know the syntax is different.... (I'm getting old.... I hope )

Then I have another question. I want a record set from a stored procedure, but only the first 100 records (but the next time maybe 200).




Henri
~~~~
It's taken a long time, but I've just about learned how to quit flapping my arms and float. It's good to float.
-Al Pacino

nr
SQLTeam MVY

12543 Posts

Posted - 2004-10-27 : 04:43:38
You can't.
Options
Put the results of the sp into a temp[ table
Turn the sp into a table valued function.
Use openrowset/openquery to exec the SP on another connection.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

henrikop
Constraint Violating Yak Guru

280 Posts

Posted - 2004-10-27 : 05:01:51
Thx, Nigel!

You can't imagine how much I use the code on your page and your quotes .

Henri
~~~~
It's taken a long time, but I've just about learned how to quit flapping my arms and float. It's good to float.
-Al Pacino
Go to Top of Page
   

- Advertisement -