Monday, December 19, 2005

Script with IF NOT EXISTS - SQL 2005

Is there a way to generate script (with IF NOT EXISTS) of stored procedures in a SQL Server 2005 database?
In the Object Explorer (Management Studio/WorkBench)
Right Click on the DatabaseName
Select Tasks
Generate Scripts
Select the Database Name from the list (again!) and click Next. This will show you list of options.
Make sure “Include IF NOT Exists” option is set to true
Check “Stored Procedures” from the list

No comments: