T-SQL to generate create table script?

  • If you install SSMS 2008, you can use the filter option to filter the list of tables to only those you want and script them.

    Or, if you install Powershell and download and install the snap-in for SQL Server, you could do the following:

    PS> CD sqlserver:\sql\{server}\{instance}\databases\{database}\tables

    PS> Get-ChildItem | % {$_.Script()}

    You can expand on the above to filter how you want and output to a separate files as needed.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

Viewing post 16 (of 15 total)

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