views:

388

answers:

3

Hi

I am using SQL Server 2005. If I try to generate scripts for the dB using the Generate Scripts wizard in the management studio (Right click dB-> Tasks-> Generate Scripts)

I get no option like IF EXISTS DROP condition in the list. Whereas some of the SQL Servers installed on different machines have this option enabled.

Is the service pack missing or any option needs to be modified to get this feature?

+1  A: 

If you right-click there is a page in the wizard where you can set your scripting options. One option is "Include IF NOT EXISTS". Or goto the Tools -> Options -> SQL Server Object Explorer-> Scripting to set this.

Mitch Wheat
A: 

@Mitch Wheat

"Include IF NOT EXISTS"=true will include the table/procedure if it doesnt exist.

But what I need is, If it exists drop it. And then create whatever in the script.

A: 

When I execute this command, all I get is a CREATE DATABASE statement and then the associated options are set.

You want to generate a DROP DATABASE statement?

It doesn't look like this functionality is present, but you can generate the drop statement and then paste it in front.

Sam