Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing a Stored Procedure from a View

Status
Not open for further replies.

dusanv

Programmer
May 29, 2002
20
0
0
Hello,

I tried to follow a workaround from some book for executing sp's from a view and created a linked server entry called LOOPBACK on my server that refers back to itself. Then I tried to create a view that has this statement:

SELECT * FROM OPENQUERY(LOOPBACK,'EXEC dbo.sp_test')

However, I am getting an error that dbo.sp_test stored procedure cannot be found even though it does exists in the database. Any insight on this -- thanks.
 
Which database is the SP in? Try adding the database name to the query.

SELECT * FROM OPENQUERY(LOOPBACK,'EXEC dbname.dbo.sp_test')
Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions.
 
Yes, supplying the database name solved the problem. The stored procedure is in the same db as the one I'm creating a view in, so I didn't think supplying a database name was not neccessary. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top