What SQL Statements Are Currently Executing?

  • Comments posted to this topic are about the item What SQL Statements Are Currently Executing?

  • Heh... and I get my butt chewed for using deprecated forms of aliased column names. 😉 I don't feel so bad, now.

    --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)

  • Really helpful

  • I get this error when creating the SP: Msg 102, Level 15, State 1, Procedure dba_WhatSQLIsExecuting, Line 42 Incorrect syntax near '.'.

    Line 42 is the 'CROSS APPLY' line.

    Can anyone help?

  • Mark,

    are you sure you are running this against a SQL2005 instance?

    Kev

  • Kev,

    Thanks - the server was 2005 but the compatibility level was still 2000. It worked find after that change.

    Mark

  • I ran this in a new query window and it ran successfully. I did not get an output. How do I view the results????

    If I run it again I get the following message.

    Msg 2714, Level 16, State 3, Procedure dba_WhatSQLIsExecuting, Line 17

    There is already an object named 'dba_WhatSQLIsExecuting' in the database.

  • dhayes,

    I guess you are new to SQL 🙂

    The first time you ran the script, you were creating a stored procedure, teh scond time errored, as you found out, because the proc already exists!

    To run the proc use

    exec dba_WhatSQLIsExecuting

    ensuring you are in the right database.....

    Kev

  • Thank You Kev.

    I'm not new to SQL, I'm just not a SQL DBA. I work with Sql every day, just don't normally call Stored procedures. Primarily do backups, and Database creations.

    Thanks again for the info.

    Don

  • Msg 170, Level 15, State 1, Procedure dba_WhatSQLIsExecuting, Line 26

    Line 26: Incorrect syntax near 'MAX'.

    -- IRADBA Wannabe

  • This is very Useful..

    Thanks Very Much!

  • I got that same message when trying this script on a SQL2000 server. This script is only for SQL2005.

  • That explains it! Thanks!

  • How to change the compatibility mode?

  • This is great. It will be very useful in nailing down those sneaky, long running processes that you can't get a peek at with the standard tools. Thanks!

Viewing 15 posts - 1 through 15 (of 39 total)

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