How can I see the complete running SQL Statement in SQL Server 2000?

  • I'm trying to assist in debugging a sql issue on a SQL Server 2000 box. Using Enterprise Manager, if I look at Current Activity> Process Info and click on the running process, I only see a small portion of the expected sql statement. Is there a way to see the whole statment? I'm not that familiar with the sql server env, so I don't know where to find this. This is a vendor application, so I can't see the source code that's generating the statement. I need to see it, as it's running, similarly to Oracles OEM.

    Thanks

    Bob
    Not a downstroke, fistpicker

  • This is the code i use to get the current running sql queries

    SELECT st.text, r.session_id, r.status, r.command, r.cpu_time, r.total_elapsed_time

    FROM sys.dm_exec_requests r

    CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS st

  • When I run that, in the Master DB, it has an issue with the cross apply as well as the sys.view or table. Is that a SQL Server 2000 or 2005 syntax?

    Bob
    Not a downstroke, fistpicker

  • It is 2005 this is the 2005 forum., sorry i skimmed the 2000 part in your post.

    I will have a look at writing this for 2000

  • Doh! My mistake. I didn't notice the forum header had changed when I was looking originally. I posted this in the 2000 forum. I didn't see how to delete this thread though.

    Bob
    Not a downstroke, fistpicker

  • steveb (9/29/2008)


    This is the code i use to get the current running sql queries

    SELECT st.text, r.session_id, r.status, r.command, r.cpu_time, r.total_elapsed_time

    FROM sys.dm_exec_requests r

    CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS st

    For 2000, you can use

    DBCC inputbuffer (spid)

    Kindest Regards,
    Shivaram Challa
    (http://challa.net - Home of the "Excel to CSV converter & Browsepad applications".)
    Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Hmmm, that's what I thought. The query, although running, shows up incomplete in that as well. It's like there's as special character or something that's causing it to display funny. It's not that long (maybe 250 chars) before the truncate. I ran a sql trace on this box, and the statement is sort of complex and ends with "for xml auto". I'm wondering if this syntax is throwing off all the monitoring tools?

    Bob
    Not a downstroke, fistpicker

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply