Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
daniel.taga
Starting Member
3 Posts |
Posted - 2011-02-26 : 06:03:34
|
| I am doing this way but can't get insert'sSELECT REPLACE (REPLACE ([text], CHAR(13), ' '), CHAR(10), ' ') AS QUERYFROM sys.dm_exec_cached_plans AS pCROSS APPLY sys.dm_exec_sql_text (p.plan_handle)WHERE p.objtype = 'Adhoc' AND cacheobjtype = 'Compiled Plan'and substring([text],0,4) = 'upd'or substring([text],0,4) = 'ins'while with this other one i can get some of the inserts but not all of them... Select substring(sql.text, stmt_start/2,CASE WHEN stmt_end<1 THEN 8000 ELSE (stmt_end-stmt_start)/2 END) AS QUERY From master.dbo.sysprocesses sp (NOLOCK)cross apply sys.dm_exec_sql_text(sp.sql_handle) AS sql inner join sys.dm_exec_connections as sp_con on sp.spid = sp_con.session_idwhere substring(substring(sql.text, stmt_start/2,CASE WHEN stmt_end<1 THEN 8000 ELSE (stmt_end-stmt_start)/2 END),0,4) = 'upd'or substring(substring(sql.text, stmt_start/2,CASE WHEN stmt_end<1 THEN 8000 ELSE (stmt_end-stmt_start)/2 END),0,4) = 'insi am new to sql... can somebody help me get all the insert/update/delete statements from a running sql server? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-02-26 : 09:10:41
|
| can you explain what you're trying to do here. quite difficult to determine from the code posted------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|