2016-08-16 60 views

回答

0

按照受DML行,你可以使用OUTPUT子句,例如

delete from #test where id IN (1,2,3) 
output deleted.* 

按照有多少行受到影响

select @@rowcount 

裁判:https://msdn.microsoft.com/en-us/library/ms187316.aspx

+0

嗨更好的阅读,我需要知道如何监控在存储过程调用 –

0

目前执行存储过程中调用的SQL语句

使用SQL Profiler你可以跟踪哪些即席SQL语句或存储过程都被打你的数据库服务器,但如果你想你的存储过程中得到了长时间运行的语句,那么你可以使用sys.dm_exec_requests表像

SELECT * 
FROM sys.dm_exec_requests requests 
ORDER BY total_elapsed_time DESC 

对于这张支票上Determine the Currently Executing Statement in a Long Running SQL Stored Procedure

+0

以上SYS表显示“创建DBO运行的SQL语句。。我需要知道当前执行哪部分内部过程以及SQL –

+0

@VeeraV中受影响的行,检查该答案中的博客链接,您将会看到一个更好的主意 – Rahul

相关问题