Reputation: 13730
There is a process that seems to be running all the time in SQL Server 2005 activity monitor. Double clicking on it produces the following query:
CREATE TABLE #tmpDBCCinputbuffer ([EVENT TYPE] NVARCHAR(512),
[PARAMETERS] INT, [EVENT Info] NVARCHAR(512))
INSERT INTO #tmpDBCCinputbuffer EXEC ('DBCC INPUTBUFFER(58)')
SELECT [EVENT Info] FROM #tmpDBCCinputbuffer
Any idea what it is? Is it dangerous?
Upvotes: 5
Views: 4192
Reputation: 449
I just want to share another answer which further explains Neil N's answer.
The DBCC INPUTBUFFER(spid) command will return the text of the most recent batch executed against a specified SPID. When you double-click on a row in Activity Monitor (or right-click and select 'Details') then, under the covers, SQL Server runs the command you quoted in your post above (substituting the SPID of the selected row - 61 in your example) to return the most recent batch issued against the connection. In your example the batch actually happens to be the CREATE TABLE etc... batch that was issued by Activity Monitor to return the most recent batch!
by Chris Howarth https://social.msdn.microsoft.com/Forums/sqlserver/en-US/6bbe405b-b7d8-4f97-9150-cf03c59d4fe3/process-wont-die?forum=sqldatabaseengine
The number 58 is what it will always return because it's its Process ID and it's the last process you run!
Upvotes: 0
Reputation: 25268
Ironically, its the query you use to see the last query run on a connection, which is what you are doing to see what all the connections' last queries were. Including the connection you use to look at all those connections.
where's the dizzy emoticon when you need it?
Upvotes: 7
Reputation: 4097
http://msdn.microsoft.com/en-us/library/ms187730.aspx
Quote from SQL Server Developer Center
"DBCC INPUTBUFFER permissions default to members of the sysadmin fixed server role only, who can see any SPID. Other users can see any SPID they own. Permissions are not transferable." (http://msdn.microsoft.com/en-us/library/aa258826(SQL.80).aspx)
Upvotes: 0