October 3, 2003 at 3:30 pm
Hello,
This is going to be a dumb question, but how do I execute a Stored Procedure from a View?
I have a View called WOApproveAccess_vw and I need to execute a Stored Procedure called WOApproveAccess2_sp. There are no parameters in the SP.
I was not able to find a clear explanation for how to do this in BOL.
Thanks
CSDunn
October 3, 2003 at 5:03 pm
You can't, sorta. You can select from it using openrowset. A hack, but sometimes good enough.
Andy
October 5, 2003 at 1:09 pm
cdun,
What is it that the sp is supposed to do? If you are using it to return a flag stating whether or not a record is approved can you put the code in a user-defined function and then call that from the view??
Good Luck
AJ Ahrens
Good Hunting!
AJ Ahrens
webmaster@kritter.net
October 6, 2003 at 1:57 am
Another option would be to have the stored procedure run the view using a SELECT statement. This wouldn't work if you used an updateable view though.
Alternatively if you wish to validate data, or run a routine on insert,update or delete try using a trigger.
October 6, 2003 at 7:13 am
If your view just returns a recordset, why not just replace the view with a SP?
Tim
October 7, 2003 at 5:28 am
I think the main issue here may be the way you are going around getting your data out.
There may be a better way of achieving what you want. Can you post more details of what you want out?
October 7, 2003 at 10:03 am
quote:
Can you post more details of what you want out?
I have a fix for now, but I do want to explore some alternatives for doing this. When I have an opportunity, I'll post again with further details.
Thanks for your help!
CSDunn
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply