What SQL Statements Are Currently Executing?

  • ianstirk

    Ten Centuries

    Points: 1310

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

  • Jeff Moden

    SSC Guru

    Points: 994279

    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.
    "If you think its expensive to hire a professional to do the job, wait until you hire an amateur."--Red Adair
    "Change is inevitable... change for the better is not."
    When you put the right degree of spin on it, the number 3|8 is also a glyph that describes the nature of a DBAs job. 😉

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

  • Gerhard Schmeusser

    SSChasing Mays

    Points: 611

    Really helpful

  • Mark Underhill

    Valued Member

    Points: 60

    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?

  • kevriley

    SSCrazy Eights

    Points: 8907

    Mark,

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

    Kev

  • Mark Underhill

    Valued Member

    Points: 60

    Kev,

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

    Mark

  • dhayes-797480

    SSC Rookie

    Points: 29

    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.

  • kevriley

    SSCrazy Eights

    Points: 8907

    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

  • dhayes-797480

    SSC Rookie

    Points: 29

    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

  • Royce Powers

    SSC Rookie

    Points: 26

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

    Line 26: Incorrect syntax near 'MAX'.

    -- IRADBA Wannabe

  • chinn

    SSCrazy

    Points: 2840

    This is very Useful..

    Thanks Very Much!

  • dhayes-797480

    SSC Rookie

    Points: 29

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

  • Royce Powers

    SSC Rookie

    Points: 26

    That explains it! Thanks!

  • o-3463522

    SSC Enthusiast

    Points: 111

    How to change the compatibility mode?

  • Jamie Pick

    Grasshopper

    Points: 22

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

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