none
Script to recreate existing tables including indexs

    Question

  • Hi SQL Gurus,

    I need to get the generate table scripts for Selected tables(around 200) from many tables in the data base. Is there a query avaialble to do it? It chould include triggers, constraints and indexs in the table.

    Any help is appreciated.


    My Blog    |      Ask Me     |      SSIS Basics     

    Wednesday, March 06, 2013 1:12 PM

Answers

  • Hit the advanced button and then set your options for the script generation:


    Chuck Pedretti | Magenic – North Region | magenic.com

    • Marked as answer by Sudeep Raj Wednesday, March 06, 2013 1:36 PM
    Wednesday, March 06, 2013 1:24 PM

All replies

  • Easiest way is to just use the tools built into SSMS to generate the scripts.  Right click on the database name - > tasks - > generate scripts.

    If you must do it in a sql script there are plenty of examples on the web - finding one that works properly is the big challenge


    Chuck Pedretti | Magenic – North Region | magenic.com

    Wednesday, March 06, 2013 1:16 PM
  • Thanks Chuk, but that does not provide the Index information :(

    My Blog    |      Ask Me     |      SSIS Basics     

    Wednesday, March 06, 2013 1:20 PM
  • Thanks Chuk, but that does not provide the Index information :(

    My Blog    |      Ask Me     |      SSIS Basics     


    Sure it does.  You just havn't got it set up correctly

    Chuck Pedretti | Magenic – North Region | magenic.com

    Wednesday, March 06, 2013 1:21 PM
  • Hit the advanced button and then set your options for the script generation:


    Chuck Pedretti | Magenic – North Region | magenic.com

    • Marked as answer by Sudeep Raj Wednesday, March 06, 2013 1:36 PM
    Wednesday, March 06, 2013 1:24 PM
  • Oh yes, thanks a lot. How did I miss that :)

    My Blog    |      Ask Me     |      SSIS Basics     

    Wednesday, March 06, 2013 1:36 PM