@@variables

  • Is there a central location where all the @@ variables are described? What I am hoping for is a variable that contains the currently executing line number of the script. Currently I hard code that number for my debug, but of course as lines are added deleted those number drift.

    I would add that searching for @@ in sql server does not seem to do the trick, and if I search for some known quantity (@@ROWCOUNT, etc.) I get the descriptions for that particular one, but no reference to the rest.

    <><
    Livin' down on the cube farm. Left, left, then a right.

  • didn't find a single list from Microsoft, but i found this one on codeproject:

    http://www.codeproject.com/Articles/39131/Global-Variables-in-SQL-Server

    •@@CONNECTIONS

    •@@MAX_CONNECTIONS

    •@@CPU_BUSY

    •@@ERROR

    •@@IDENTITY

    •@@IDLE

    •@@IO_BUSY

    •@@LANGID

    •@@LANGUAGE

    •@@MAXCHARLEN

    •@@PACK_RECEIVED

    •@@PACK_SENT

    •@@PACKET_ERRORS

    •@@ROWCOUNT

    •@@SERVERNAME

    •@@SPID

    •@@TEXTSIZE

    •@@TIMETICKS

    •@@TOTAL_ERRORS

    •@@TOTAL_READ / @@TOTAL_WRITE

    •@@TRANCOUNT

    •@@VERSION

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • By that list it looks like I am out of luck.

    Thanks for the effort.

    <><
    Livin' down on the cube farm. Left, left, then a right.

  • In the CATCH section of a TRY/CATCH block, you can use ERROR_LINE(), however it returns NULL if there is no current error.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

Viewing 4 posts - 1 through 3 (of 3 total)

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