How to insert variables in rows

  • Hello,
     I have sp
    Takes multiple parameters A1 A2 A3 A4
    How can I insert them each in a row
    Thanks

  • the same row?
    INSERT INTO MyTable(col1, col2, col3, col4) VALUES (@param1, @param2, @param3, @param4);

  • Based on the question and if you intend to use SQL on a regular basis (you are creating a stored procedure so I assume you're doing something with SQL on a regular basis), I would urge you to take some time to learn about the SQL language.  That's not meant as a slam.  It's meant as a recommendation to keep you out of trouble and to further your career.

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