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!

Calling a stored procedure

Status
Not open for further replies.

bertrandkis

Programmer
Jul 26, 2002
101
0
0
ZA
Does any one knows how to call a stored procedure from a view? Is this possible?
 
No...you can't.
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
You could create a user-defined function that returns a table, but you still can't EXECute a stored procedure. You would have to duplicate the stored procedure code inside the function. A sticky solution, but maybe possible.

Another way that might work is using OPENQUERY to call the procedure as a pass-through query back to the same SQL Server you are running on. Another sticky possibility. Good luck!

--John [rainbow]
-----------------------------------
Behold! As a wild ass in the desert
go forth I to do my work.
--Gurnie Hallock (Dune)
 
You may want to just avoid using the View and use a SP instead. That would be much better than using a UDF inside the view.
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top