generate insert statements with data

  • WayneS (8/9/2010)


    Jeff Moden (8/8/2010)


    drew.allen (8/7/2010)


    Here's an example using the Information_Schema.Tables view. WARNING: XML is case sensitive

    Thanks, Drew. Rumor has it that it's also pretty touchy about special characters like ampersands and the like. Is there a hook you can add to keep those from being a problem?

    Use

    .value('.','VARCHAR(MAX)')

    , like this

    Edit: Hey! Does this mean I've (finally) taught Jeff something? :w00t:

    Heh... no, sorry. Not this time although that's an excellent post you linked to. You need "TYPE" to go along with that. The reason why I asked the question is that I was trying to get Drew to cough up the code so I wouldn't have to say "Dude, I think you need to add the following...". 😛

    --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 post 16 (of 15 total)

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