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)
 How to query the result of a sp_ procedure?

Author  Topic 

Mathias
Posting Yak Master

119 Posts

Posted - 2002-04-29 : 02:46:37
How could I query the result of an sp_ procedure?

Example :

use pubs

exec sp_column_privileges @table_name='jobs'



dsdeming

479 Posts

Posted - 2002-04-29 : 07:59:41
You can always use INSERT INTO ... EXECUTE syntax:

INSERT INTO mytable
exec sp_column_privileges @table_name='jobs'

Then you can query mytable as much as you'd like.

Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-04-29 : 08:26:04
If you are using Sql 7.0 this wouldnt work .

you can try this


SELECT a.*
FROM OPENROWSET('SQLOLEDB','servername';'sa';'password',
'exec mydatabase.dbo.sp_yoursp') AS a

quote:

You can always use INSERT INTO ... EXECUTE syntax:

INSERT INTO mytable
exec sp_column_privileges @table_name='jobs'

Then you can query mytable as much as you'd like.





--------------------------------------------------------------
Go to Top of Page

mohamedyousuff@yahoo.com
Starting Member

24 Posts

Posted - 2002-04-29 : 08:37:03

I think User defined functions will perform better particularly if the stored procedure could be implemented as Inline User-Defined functions.

Then you can query the output of the function like

select * from MyFunction()



S.Mohamed Yousuff






quote:

If you are using Sql 7.0 this wouldnt work .

you can try this


SELECT a.*
FROM OPENROWSET('SQLOLEDB','servername';'sa';'password',
'exec mydatabase.dbo.sp_yoursp') AS a

quote:

You can always use INSERT INTO ... EXECUTE syntax:

INSERT INTO mytable
exec sp_column_privileges @table_name='jobs'

Then you can query mytable as much as you'd like.





--------------------------------------------------------------




Go to Top of Page

Utpal
Posting Yak Master

179 Posts

Posted - 2002-09-11 : 02:51:43
quote:


you can try this


SELECT a.*
FROM OPENROWSET('SQLOLEDB','servername';'sa';'password',
'exec mydatabase.dbo.sp_yoursp')



I am trying to use this to open a cursor in a sp. But I don't want to hard code the user name and password. For user name I could use the SUSER_SNAME() function, what about password? Is there any function that returns the current user's password?


Go to Top of Page
   

- Advertisement -