从 SQL 视图执行 SQL 存储过程 [英] Execute a SQL stored proc from a SQL view

查看:64
本文介绍了从 SQL 视图执行 SQL 存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现在 Excel 中调用存储过程并不像它应该的那么容易,但是调用视图或直接表非常容易.那么,如何创建一个视图来调用一个没有参数的存储过程?

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.

select exec MyStoredProc() 这样的东西会很棒.

something like select exec MyStoredProc() would be great.

推荐答案

iirc(我手头没有副本)如果您碰巧在 T-SQL 中,应该可以从 中选择 *用户定义的表函数(大多数意图和目的与 sprocs 相同),它返回一个表变量.

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.

这篇关于从 SQL 视图执行 SQL 存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆