Calling a stored procedure in a SELECT list on SQL Server 2000

Tags:
SELECT statement
SQL Server 2000
SQL stored procedures
Stored Procedures
I am using SQL Server 2000, and my question is: is there any way to call a stored procedure in a SELECT list?

Answer Wiki

Thanks. We'll let you know when a new response is added.

No, stored procedures can not be called as part of a select statement.

You can either create a temp table and load the data from the output of the stored procedure into the temp table, then join to the temp table, or convert the stored procedure into a function which can then be included as part of a select statement.

Not quite true…

It can be done by setting up a linked-server reference and then use OPENQUERY. See books online.

Example: SELECT * FROM OPENQUERY(linked_server name, ‘EXEC stored procedure name’)

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Denny Cherry
    Check out my SQL Server blog "SQL Server with Mr Denny" for more SQL Server information.
    66,010 pointsBadges:
    report
  • Denny Cherry
    True, it can be done via OPENQUERY, provided that you have open query enabled on your system. By default it is disabled on SQL Server 2005 and up.
    66,010 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following