• J Livingston SQL (2/13/2016)


    Jeff Moden (2/13/2016)


    mw112009 (2/12/2016)


    Jeff M

    What we need is to be able to do via T-SQL and also we need to get the def for all tables ( Not just picking one at a time )

    We found the code at another website.

    So the issue is resolved.

    Cool. Please post the link for the website that you found the code on. Thanks.

    I believe that this is the site from reading the posts

    http://sqlindia.com/generate-table-definitions-using-tsql-sql-server/

    see my post above

    Thanks, Graham. I'll check it out. I found what looks like a great article on the subject by Phil Factor. Here's the link.

    https://www.simple-talk.com/sql/database-administration/automated-script-generation-with-powershell-and-smo/

    If you know me, I'm not adverse to using xp_CmdShell to call PowerShell.

    As a bit of a sidebar, his note on using SQLCompare from the command line to generate scripts seems to be what I'd probably use just because its so bloody simple. I'm sure there are other options for that command line. It's in the beginning of the section titled "Automated scripting of objects".

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