store proc

  • sorry its deleted

  • That is because it is inside of your string. When you execute the dynamic SQL string it executes in a seperate context than your outside query, so if you want to "pass a variable" to a dynamic string, you need to build your string with the variable.

    Set @SQL = 'Select from table where user = ''' + @user + ''''

  • Mike Levan (12/11/2007)


    sorry its deleted

    That's just not nice... now we have an answer with no question.

    --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)
    Intro to Tally Tables and Functions

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

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