Generate Scripts in SQL Server 2008

  • Hello Experts,

    I am using the feature in sql server 2008 to generate scripts for all the tables within a database. I see an option "If not exists --> create table" for create table script.

    Is there an option where I can add,

    If exists --> drop table --> create table for auto generate scripts for all the user tables within a database?

    I need this because I get scripts on regular basis which create tables and table definition may change so I have to drop them first and then create all over again.

    Thanks in advance...

  • In the general options, click 'Script Drop' which is false by default.

    I think this will do what you want.

    .

  • Yes I tried this already. Surprisingly "If exists" works if I use it individually and when I use "script drop" it just drops the table but doesnt check the condition

    " if exists then drop and then create"

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

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