Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2003
    Posts
    144

    Question Unanswered: Is there a System Stored Procedure that scripts tables?

    Hello

    I wonder if I can generate the "CREATE TABLE" sentence given the name of a table by means of a stored procedure.

    Thanks a lot.

  2. #2
    Join Date
    Dec 2002
    Posts
    1,245
    Quote Originally Posted by EMoscosoCam
    Hello

    I wonder if I can generate the "CREATE TABLE" sentence given the name of a table by means of a stored procedure.

    Thanks a lot.
    I think you need the Server Management Objects (SMO) to do what you are thinking of. SMO works in SQL 2005. There's an earlier version of it in SQL 2000, but for the life of me, I can't remember the name right now.

    Regards,

    hmscott
    Have you hugged your backup today?

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    I imagine you could create one by using Profiler to examine what happens when you right click a table in Enterprise Manager select "All Tasks -> Generate SQL Script -> Preview". Be aware ahead of time, it's not a one-step process...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  4. #4
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    This free console app I wrote may be of use to you. it will generate scripts for all objects in any 2000 or 2005 database. open source so you can tweak it if you want. it uses SMO.

    I wrote it as a way to easily export the DDL for a database for checkin to a source control system.

    http://www.elsasoft.org/tools.htm

    hope it's useful to you!

  5. #5
    Join Date
    Mar 2003
    Posts
    144
    Thanks a lot!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •