Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Scripting options for Stored Procedures


Scripting options for Stored Procedures

Author
Message
carolyn v mckechnie
carolyn v mckechnie
Grasshopper
Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)

Group: General Forum Members
Points: 24 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
GSquared
GSquared
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16925 Visits: 9729
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
carolyn v mckechnie
carolyn v mckechnie
Grasshopper
Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)

Group: General Forum Members
Points: 24 Visits: 55
Yes, thanks, but it doesn't generate the IF EXISTS part of the drop statement...
GSquared
GSquared
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16925 Visits: 9729
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
carolyn v mckechnie
carolyn v mckechnie
Grasshopper
Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)

Group: General Forum Members
Points: 24 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
carolyn v mckechnie
carolyn v mckechnie
Grasshopper
Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)Grasshopper (24 reputation)

Group: General Forum Members
Points: 24 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
Chenman
Chenman
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search