sp_who2 and sysprocesses.

  • Dear Experts

    sp_who2 is a stored procedure and shows the details of the active connection to the server. Similarly "sysprocesses" table can also be used to fetch the same details along with some additional attribute details.

    Is the only reason to choose sysprocesses table?

    One thing I have noticed when you fire "select * from sysprocesses", many SPIDs will be reflected and look little clumsy to investigate the details rather "sp_who2" is little better.

    Can you shade some light on this with your experience on this!

    Thanks.

  • I'm not sure what the question is. If you're asking why to ever use the SysProcesses table instead of sp_Who2, it may be because there are a lot of people who need the data in a table format and don't understand how to capture the output of sp_Who2 in a table for additional processing. The big problem for most is the fact that sp_Who2 outputs 2 identical SPID columns which messes up most chances to create a table on the fly and people don't want to take the time to map one out so they can do a very simple INSERT/EXEC.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 2 posts - 1 through 1 (of 1 total)

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