Script Tables does not include IF EXISTS, Indexes, Contraints, etc

  • I scripted out tables in a schema so that I could create a separate Database.

    In prior versions the script would drop the object if it exists.

    It would also include all Indexes and Constraints.

    What am I doing wrong?

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • scripting options is what you skimmed over; there are lots of stuff you can turn on and off:

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • If you are using Database --> Tasks --> Generate scripts, you have a similar options screen where you can define all scripting options.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Lowell (6/3/2012)


    scripting options is what you skimmed over; there are lots of stuff you can turn on and off:

    At least in my installation, there are no scripting options available in SSMS 2012.



    Ole Kristian Velstadbråten Bangås - Virinco - Facebook - Twitter

    Concatenating Row Values in Transact-SQL[/url]

Viewing 4 posts - 1 through 3 (of 3 total)

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