Home Forums SQL Server 7,2000 In The Enterprise Is There A Way To List Current Activity, Such As Primary Key? RE: Is There A Way To List Current Activity, Such As Primary Key?

  • Brute force nah with finesse / elegance.

    This has got me intrigued ... been a long time since working with 2000, but here may be something to stir your creative juices even more.. if memory serves me correcting a Spid less than 50 is a system spid not a user spid. That said run the followng as an insert into a temp table.

    SELECT spid,Db_Name(dbid) FROM Master..sysprocesses WHERE Spid > 49 AND DB_Name(dbid)

    LIKE '%Northwind%'

    Then using the entries in the temp table run the following command

    into another temp table.

    DBCC INPUTBUFFER (spid value)

    Then a select on the 2nd temp table with a LIKE clause for your table name.

    Also look at fn_get_sql available from a 2000 update, and you should have same if not seach TECHNET for the hot fix.

    fn_get_sql uses the sql_handle from sysprocess to return the SQL statement.. negating the need to use the DBCC command.

    Being optimistic, if this all works out how about posting the code on the forum so others may learn ...

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]