Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2009-01-22 : 17:29:12
|
| How to generate sql script, would like to generate close to 250 SPs script via Task/generate script:But it is not putting this on top of each SP:********************************IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[USP_GetDocContent]') AND type in (N'P'))DROP PROCEDURE [dbo].[USP_GetDocContent]GO******************The reason is where i will updating those SPs, on that server some of the SP's exist.Is there anyway from sql server 2005 to generate scripts with If exists in it.Thank you all for the information. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2009-01-22 : 20:26:44
|
| I have done this successfully in the past, and tested it again just now and it seems to work fine. I wonder if the bug was fixed in a service pack. I have SQL 2005 - 9.00.3068.00 which is service pack 2 + some hotfixes.In the wizard's script options window, I selected TRUE for "Include IF NOT EXISTS" and TRUE for "Script Drop". |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2009-01-23 : 10:40:09
|
| Thank you Tara / Sunita,It worked... |
 |
|
|
|
|
|