memory variables

  • Hi Everybody,

    Please anybody tell me, if we declare some variables in a stored procedure and we don't use them, will those variables occupy any memory while executive the stored procedure?

    Thanks in advance

  • I'm sure they occupy a little, but not anything to worry about.... unless you're declaring thousands of them or something.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Unused variables don't occupy much space... unless you have 10,000 users hitting the same proc. So far as I'm concerned, it's a bad practice and smacks of seriously sloppy code. It's one of the things I check for and will reject code for during code reviews.

    --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 3 posts - 1 through 2 (of 2 total)

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