Reputation: 299
I'm trying to get (for debug reasons) the currently running query with the query below :
SELECT sqltext.TEXT,
req.session_id,
req.status,
req.command,
req.cpu_time,
req.total_elapsed_time
FROM sys.dm_exec_requests req
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext
With this query, I get the currently running query's but not the complete query because it's cut off when the query is too big.
Is there a way to get the complete query instead of the cut-off version?
Upvotes: 0
Views: 677
Reputation: 5521
You can use the options Results To Text (or Results To File) in the management studio by pressing CTRL + T in the query window.
There is an option to set the maximum number of characters options in tools | Options dialog on the Query Results | SQL Server | Results to Grid page.
Same for results to grid, there it is maximum number of character per row.
Upvotes: 2