Skip to content

Instantly share code, notes, and snippets.

@mattiaswolff
Last active December 18, 2015 00:29
Show Gist options
  • Save mattiaswolff/5696831 to your computer and use it in GitHub Desktop.
Save mattiaswolff/5696831 to your computer and use it in GitHub Desktop.
SELECT
session_id,status,
command,sql_handle,database_id
,(SELECT text FROM sys.dm_exec_sql_text(sql_handle)) AS query_text
FROM sys.dm_exec_requests r
WHERE session_id >= 51
For more detail about was has been running, try:
select s.session_id, s.login_name, s.host_name, s.status,
s.program_name, s.cpu_time, s.last_request_start_time,
(SELECT text FROM sys.dm_exec_sql_text(c.most_recent_sql_handle)) AS query_text
from sys.dm_exec_sessions s, sys.dm_exec_connections c
where s.session_id = c.session_id and
s.session_id > 50
order by s.last_request_start_time desc
exec USP_GetInboxErrands @intUserId=16,@intLangId=5,@strSortType=N'ErrandId DESC',@strFilterExpression=N'(1=1 AND 1=1)',@strFilterAllValue=N'',@strFilterDateValue=N'',@strFilterNumericValue=N'',@intFirstRowIndex=15,@intPageSize=20,@bitSeeAll=0,@strInboxName=N'MESSAGES_INCOMING'
Meca
USP_GetInboxErrands 5 13, 11, 2, 2, 2
USP_GetInboxErrands 10 15, 2, 2, 2, 4
USP_GetInboxErrands 15 14, 4, 10, 1, 2
Azure
Original
12 2 3 2 3
12 3 3 3 2
12 3 3 2 3
exec sp_updatestats
1 11 2 2 2 2
2 11 2 2 2 2
3 12 2 3 2 2
Rebuild index + stats
1 12 2 2 2 2
2 11 2 3 2 2
3 11 2 2 2 2
CREATE INDEX [IX_INVOICE_HEAD_DueDate] ON [Meca_Mediusflow].[dbo].[INVOICE_HEAD] ([DueDate]) INCLUDE ([ID], [CompanyId], [InvoiceNumber], [InvoiceType], [InvoiceDate], [OrderNumber], [SupplierId], [CashDiscountDueDate], [Currency], [TotalAmount], [VerificationIdentity], [BookingDate], [StoreId], [ProjectNumber], [Comment], [InvoiceSupplierId])
1 12 2 2 2 2
2 11 2 2 2 2
3 11 2 2 2 2
"see all" (exec USP_GetInboxErrands @intUserId=31,@intLangId=5,@strSortType=N'ErrandId DESC',@strFilterExpression=N'(1=1 AND 1=1)',@strFilterAllValue=N'',@strFilterDateValue=N'',@strFilterNumericValue=N'',@intFirstRowIndex=55,@intPageSize=20,@bitSeeAll=1,@strInboxName=N'MESSAGES_INCOMING')
1 7 6 6 7 6
2 7 5 5 6 5
3 7 6 5 6 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment