Insert statement and column names

  • Hello,

    Can an INSERT statement also return all columns inserted as a result set? If so what clause of the INSERT statement does this?

    Thanks,

  • Can you explain further? maybe with examples.

    An insert will insert rows, not columns. You might have a valid request but I'm confused.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • You can use the OUTPUT clause for that.

    Here is a link with examples

    http://technet.microsoft.com/en-us/library/dd776381(v=sql.105).aspx

    Go down to the "Capturing the Results of the INSERT Statement" section.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

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

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