If you know the SPID of a process in OrderSavant (such as through the sp_lock or sp_who commands), you can run the following query to gain more information about that ID (the only thing that needs to be changed is the @spid variable at the top to whatever spid you want info on):
DECLARE @spid INT = 100 DECLARE @sqltext VARBINARY(128) DECLARE @dbid INT SELECT @sqltext = sql_handle, @dbid = dbid FROM sys.sysprocesses WHERE spid = @spid SELECT spid AS 'SPID', text AS 'Query Text', client_net_address AS 'Client IP', program_name AS 'Client Type', p.dbid AS 'Database ID', DB_NAME(p.dbid) AS 'Database Name', hostname AS 'Database Server', status AS 'Procedure Status', connect_time AS 'Time Connected' FROM sys.sysprocesses p INNER JOIN sys.dm_exec_connections c ON p.spid = c.session_id INNER JOIN sys.dm_exec_sql_text(@sqltext) t ON p.dbid = t.dbid WHERE spid = @spid This allows you to see what query was sent to the database, what the IP of the client is, what time it was sent, etc. The Client Type will help narrow down what client is being used (for example, ".Net SqlClient Data Provider" is the OrderSavant application/server, "Internet Information Services" is the OrderSavant webstore, etc).
If you would like to view all SPID's that are being blocked, you can also replace the last line with WHERE blocked = 0 instead.
|