Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Scripting options for Stored Procedures Expand / Collapse
Author
Message
Posted Thursday, August 14, 2008 1:35 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, December 11, 2008 4:22 PM
Points: 18, Visits: 55
I cannot seem to be able to generate the "IF EXISTS" portion of the DROP statement for Stored Procedures when using the scripting tool from the right click menu In Management Studio from the database tree under Tasks-> Generate Scripts for all stored procedures in the database. Anyone else noticed this issue? I am trying to set up baseline files for all my stored procedures in Visual Source Save and I need the DROP statements in each script file to be conditional.
Regards,
CVM

Post #553029
Posted Thursday, August 14, 2008 1:55 PM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Monday, April 14, 2014 1:34 PM
Points: 15,442, Visits: 9,588
In Management Studio, go to Tools, Options, Scripting. There's an option there to include drop statements in scripts.

- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #553062
Posted Thursday, August 14, 2008 2:13 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, December 11, 2008 4:22 PM
Points: 18, Visits: 55
Yes, thanks, but it doesn't generate the IF EXISTS part of the drop statement...
Post #553081
Posted Thursday, August 14, 2008 3:20 PM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Monday, April 14, 2014 1:34 PM
Points: 15,442, Visits: 9,588
Sorry, misread your post the first time.

No, I don't believe there is an option for that. Not in Management Studio anyway. Might be something in one of the RedGate or ApexSQL tools, or some such.


- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread

"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Post #553149
Posted Thursday, August 14, 2008 3:40 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, December 11, 2008 4:22 PM
Points: 18, Visits: 55
If you right click on a single stored proc and script out a drop statement for it, the IF EXISTS is generated as part of the DROP. This has always been the case in all prior versions of SQL Server scripting tools. I'm just wondering where this feature went for 2005 and 2008 as well... If I use IF NOT EXISTS this option generates the IF EXISTS
Post #553170
Posted Thursday, August 14, 2008 3:43 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, December 11, 2008 4:22 PM
Points: 18, Visits: 55
If you right click on a single stored proc and script out a drop statement for it, the IF EXISTS is generated as part of the DROP. This has always been the case in all prior versions of SQL Server scripting tools. I'm just wondering where this feature went for 2005 and 2008 as well... If I use IF NOT EXISTS this option generates the IF EXISTS code for the DROP statement (which is what I'm looking for) however it puts the whole CREATE statement inside an EXEC dbo.sp_executesql clause, which I don't want.
Regards,
CVM

Post #553175
Posted Tuesday, February 09, 2010 2:40 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, July 20, 2011 6:58 AM
Points: 1, Visits: 26
GSquared,

Do you know to enable Tools-Options...-Scripting in the Management Studio Menu. Because I do not see the scripting menu in there.

Thanks
Post #862750
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse