How to generate SQL database scripts into XML file format

  • Hi,

    I want to generate the database scripts into XML format (not data in the tables ..only scripts of a particular database). Can you please let me know any procedure or too available for it. I am using SQL Server 2008.

    Thanks

    IVLN.

  • from TSQL, it's very difficult; there's no native way to get the scripts in TSQL; most people end up calling something else that calls SMO via xp_cmdshell, and brings it back into a table.

    I've made a prototype procedure in the past that scripts tables in TSQL, but you'd still have to get the results into a table and produce the XML...and will the SQL-formtted xml be what you are looing for?

    Powershell or a programming language would be easier to do; both can consume or create XML very easily.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • NLV (7/15/2011)


    Hi,

    I want to generate the database scripts into XML format (not data in the tables ..only scripts of a particular database).

    I can't help because I don't even know how to spell "XML" but would you do me a favor please? Please tell us why you'd want to do such a thing instead of just using good ol' ASCII text? Thank you for your time.

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