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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 DBCC INPUTBUFFER in a select statement?

Author  Topic 

SQLServerDBA_Dan
Aged Yak Warrior

752 Posts

Posted - 2005-07-14 : 17:18:37
Is there anyway that you can include DBCC INPUTBUFFER in a UDF or something else so it can be selected from along with the sysprocesses table in a query?

Thanks,
Daniel

Daniel
SQL Server DBA

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-07-14 : 17:21:44
Do you mean like this:

SELECT 'DBCC INPUTBUFFER(' + CONVERT(varchar(5), spid) + ')'
FROM master.dbo.sysprocesses



If not, please explain further.

Tara
Go to Top of Page

SQLServerDBA_Dan
Aged Yak Warrior

752 Posts

Posted - 2005-07-15 : 10:04:40
quote:
Originally posted by tduggan

Do you mean like this:

SELECT 'DBCC INPUTBUFFER(' + CONVERT(varchar(5), spid) + ')'
FROM master.dbo.sysprocesses



If not, please explain further.

Tara



No, was actually wanting the results of DBCC INPUTBUFFER returned in a query. That way I can see what the spid is running without having to run a separate statement.

Daniel
SQL Server DBA
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-07-15 : 12:35:45
You can easily modify my code into dynamic sql. You'd put the sysprocesses data into a temp table, then loop, and EXEC(@SQL).

Tara
Go to Top of Page

SQLServerDBA_Dan
Aged Yak Warrior

752 Posts

Posted - 2005-07-15 : 14:53:22
quote:
Originally posted by tduggan

You can easily modify my code into dynamic sql. You'd put the sysprocesses data into a temp table, then loop, and EXEC(@SQL).

Tara



Yeah but by that time the process for the SPID may have already changed. I was hoping that there was some sort of way to get the results like DBCC INPUTBUFFER in a simple query that I could either join with or do a subselect in my other query with sysprocesses.

Daniel
SQL Server DBA
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-07-15 : 14:58:50
There is no way to do this without putting the results into a table of some sort.

Tara
Go to Top of Page

SQLServerDBA_Dan
Aged Yak Warrior

752 Posts

Posted - 2005-07-15 : 16:33:28
quote:
Originally posted by tduggan

There is no way to do this without putting the results into a table of some sort.

Tara



Yeah, that's what I was afraid of. I was hoping there was some sort of undocumented proc named XP_INPUTBUFFER or something fun like that.

Daniel
SQL Server DBA
Go to Top of Page
   

- Advertisement -