exec sp_execute的疑问

ChinaITOldMan 2014-05-06 09:50:30

1.请问Exec sp_execute是怎样使用的(或是做什么用的)?它和sp_executesql有什么区别?
2.下面语句块中sp_execute后的参数分别是什么意思?

declare @p4 bit
set @p4=0
exec sp_execute 4,'CalcBOM','ITEMNO',@p4 output
select @p4
...全文
488 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
黄_瓜 2014-05-07
  • 打赏
  • 举报
回复
引用 6 楼 mcxhh2005 的回复:
你好,你是说在profile中勾取SP:StmtCompleted后才能看到Sp_execute执行的具体语句吗?谢谢!
ChinaITOldMan 2014-05-07
  • 打赏
  • 举报
回复
你好,你是说在profile中勾取SP:StmtCompleted后才能看到Sp_execute执行的具体语句吗?谢谢!
黄_瓜 2014-05-07
  • 打赏
  • 举报
回复
4的内容需要用profile才能看到,勾选SP:StmtCompleted 事件
黄_瓜 2014-05-07
  • 打赏
  • 举报
回复
黄_瓜 2014-05-07
  • 打赏
  • 举报
回复
sp_execute是由客户端API执行准备好的语句。 (ODBC,ADO.NET等) 先用sp_prepare 去准备语句 在用sp_execute去执行 最后用 sp_unprepare去释放 sp_executesql是使用TSQL动态查询。
KevinLiu 2014-05-07
  • 打赏
  • 举报
回复
用法不同: sp_execute is used with prepared statements by client APIs. (ODBC, ADO.NET etc) sp_executesql is used by tsql for dynamic queries.
ChinaITOldMan 2014-05-06
  • 打赏
  • 举报
回复
谢谢楼上,那篇文章是讲Exec与sp_executesql的,我现在想了解sp_execute的用法及与exec、sp_executesql的区别的

22,301

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧