locked
generate create table script RRS feed

  • Question

  • Hi,

            Is there a build-in system procedure in SQL 2005 which can generate "create table scripts" as output?

    I know how to do in UI level, but I'm not sure if it's possible to do on query level.

     

    for example,

     

       exec   sp_get_create_table_script @tablename='employees',@include_index='Y',@Include_trigger='Y'

     

     

     

    Thanks

     

     

     

     

    Thursday, July 24, 2008 6:42 PM

Answers

  • In SQL 2008 it is integrated with its own provider and cmdlets. However, you can use powershell and SMO on SQL Server 2005. I have just started messing around with it in SQL 2008. Here is a 10 part series on it and the have samples on object scripting with SMO and powershell.
    http://www.databasejournal.com/features/mssql/article.php/3681061

    Thursday, July 24, 2008 8:47 PM
    Answerer

All replies