是否有可能在sql server 2000中运行sys.dm_exec_sql_text

时间:2013-05-16 15:40:22

标签: sql-server sql-server-2000

有没有人知道这个查询是否可以转换并在sql 2000中运行

SELECT deqs.last_execution_time AS [Time], dest.TEXT AS [Query]
FROM sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
WHERE dest.TEXT like '%sp_OACreate%'
ORDER BY deqs.last_execution_time DESC

由于

1 个答案:

答案 0 :(得分:2)

这可能对你有所帮助 -

SELECT 
      spid
    , login_time
    , last_batch
    , [status]
    , loginame
    , [db_name] = DB_NAME([dbid])
    , (SELECT [text] FROM ::fn_get_sql(sp.[sql_handle])) Command 
FROM [master].dbo.sysprocesses sp 
WHERE spid = @@SPID