Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 87715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:26:46+00:00 2026-05-10T22:26:46+00:00

In MS SQL Server Management Studio 2005: If you have the setting Tools|Options|Scripting|Include IF

  • 0

In MS SQL Server Management Studio 2005:

If you have the setting Tools|Options|Scripting|’Include IF NOT EXISTS clause’ set to true, modifying a stored procedure will create a strange script that doesn’t even work. It looks something like the following: (ellipsis used for brevity)

 SET QUOTED_IDENTIFIER ON  GO  IF NOT EXISTS [...]  BEGIN  EXEC dbo.sp_executesql @statement = N'  ALTER procedure [dbo].[p_Procedure]  [...]  '  END 

This obviously doesn’t work because the only way the ALTER statement is called, is if the stored procedure DOESN’T exist.

The question is thus: is there any way of changing this generated code? A template out there somewhere (this doesn’t seem to be related to the build in Templating tools)?

(A slight explanation for this behavior: scripting a CREATE statement generates the same code in which the IF NOT EXISTS makes more sense)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:26:47+00:00Added an answer on May 10, 2026 at 10:26 pm

    There are some issues on this topic on MS-feedback site. Here are one:

    https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=260519

    Here are one comment on that issue (from the bottom of the page linked above):

    In SQL2000, the approach was If exists, DROP followed by a CREATE. This worekd flawlessly and covered all cases. It wored so well that we built our deployment off of this scripting model. Since SQl2005 entered our world, we have had manual, cumbersome workarounds to replace the automated scripting that was lost in the move to SQL2000.

    Please do readd the If exists, DROP followed by a CREATE approac. It was great the way

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 97k
  • Answers 97k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If by "send" you mean "create", then you can do… May 11, 2026 at 7:21 pm
  • Editorial Team
    Editorial Team added an answer Simply, Dictionary<TKey,TValue> is a generic type, allowing: static typing (and… May 11, 2026 at 7:21 pm
  • Editorial Team
    Editorial Team added an answer SQL is interpreted, even though it is said to be… May 11, 2026 at 7:21 pm

Related Questions

We're in the process of setting up a new framework and way of doing
Using MS SQL Server Management Studio 2005 - To Restore a Database: Restore Database
I have backed up and restored a MS SQL Server 2005 database to a
I'm trying to script an MS SQL Server 2005 database to a single file.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.