I am finding that calling a stored proc in Excel is not as easy as it should be, but calling a view, or a direct table is very easy. So, how can I create a view that will call a stored proc with no params?
I know I won't be able to pass any values into the view, and I don't need or want to, Just want to wrap a stored proc in a view.
something like select exec MyStoredProc()
would be great.
You can do the subqueries-to-temp table stuff in a stored procedure, but you can't call a stored procedure from a view.
Answers. No, but most-likely you can convert your stored procedure to a table-valued function. Then you can call the table-valued function in a view.
Using SQL Server Management Studio Expand the database that you want, expand Programmability, and then expand Stored Procedures. Right-click the user-defined stored procedure that you want and select Execute Stored Procedure.
A stored procedure is a prepared SQL code that you can save, so the code can be reused over and over again. So if you have an SQL query that you write over and over again, save it as a stored procedure, and then just call it to execute it.
iirc (I don't have a copy to hand) if you happen to be in T-SQL it should be possible to select * from a user defined table function (which are for most intents and purposes identical to sprocs) which returns a table variable.
You should be able to put a trigger on a dummy table, and call the proc inside the trigger.
This is definitely a hack, and you would want to really lock down permissions on the table and proc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With