Search
Active

132
Sign in to vote
3
Sign in to vote
Sign in
to vote
Type: Suggestion
ID: 127219
Opened: 11/3/2005 4:34:24 AM
Access Restriction: Public
Duplicates: 487763
4
Workaround(s)
Since I couldn't find a category called something like "T-SQL Syntax" I decided to post this here.

Maybe I missed something in the CTP docs, but it appears that I will still have to do object existence checks (i.e. IF EXISTS (SELECT...) DROP....) before running a CREATE or ALTER statement. If I don't have to do this anymore and I just missed it in the docs somewhere please disregard the following and thanks!

You guys did a great job getting 2005 to be more declarative (i.e. CREATE LOGIN). Please make the existence check enhancement to reduce typing and make people's SQL more readable.
Details (expand)
Product Language
English
Version
SQL Server 2005 Community Technology Preview Sep 2005 - Developer Edition (32)
Category
SQL Engine
Operating System
Windows XP SP2 Professional
Operating System Language
English
Proposed Solution
Provide declarative equivalent of existence checks. Something equivalent to Oracle's CREATE OR REPLACE. It could be called something like CREATE OR ALTER.
Benefits
Faster Development
Other Benefits
Faster Development
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 11/3/2005 at 1:56 PM
Hello,

The "CREATE or REPLACE" like syntax is not part of SQL2005. We are considering it for a future release.

Thanks for your feedback.

Sameer Verkhedkar
sameerv@microsoft.com
[MSFT]
Posted by noggincafe on 9/6/2007 at 9:28 AM
The lack of this feature shouldn't just be "considered". No wonder folks talk about SQL Server as if it were a joke.
Posted by neudesic1 on 10/17/2007 at 10:59 AM
Seriously guys? Just put it in there. Don't make us wait for Katmai, only to find out it's not in there either, add it to a Service Pack for crying out loud. It's almost embarrasing that we don't have that one small feature.
Posted by -sg- on 1/20/2008 at 7:53 PM
Please add this feature as a priority
Posted by qking on 1/25/2008 at 1:52 PM
Perhaps a "create procedure [...] with drop_existing" syntax? This would be consistent with "create index." In addition to simply making scripting more convenient, this option would allow a procedure to be replaced without the need to replace all permissions, as happens with a drop/create.
Posted by Microsoft on 2/6/2008 at 10:54 AM
Hello

Thank you for your continued feedback on this feature. We will not be able to support CREATE OR ALTER functionality in the upcoming SQL Server 2008 release. We are actively tracking this feature request and will consider it for a future release of SQL Server.

Thanks

-- SQL Server Engine Team
Posted by BAnVA on 2/7/2008 at 4:57 AM
While your response doesn't surprise me, it is a complete joke. I requested this feature in November of 2005 so you've had ample time to work this into the SQL 2008 release.

The good news is that this issue has become irrelevant since I switched to Ruby on Rails and MySQL in January of 2006. Why? Because of Microsoft's lack of direction and complete lack of concern for critical developer requests - like implementing a REAL O/R mapping solution just to name one.
Posted by Steven Wilmot on 11/26/2008 at 4:08 AM
Sadly, I would agree with the statement that "While your response doesn't surprise me, it is a complete joke."

The SQL Development team had about 26 months to respond to the initial comment/request ... There would seem to be two possibilities.
1 - They didn't KNOW about the request (if not, then WHY NOT ? What's the point of us developers providing feedback requests ?)
2 - They didn't CARE about the request (if so, then why was there no further feedback on the connect-site?)

Unlike the "major" new features like "SQLCLR , FILESTREAM or Spatial Types, surely this is a relatively-small feature to add.
This isn't so much "new functionality", but is more "combining two features into one simpler syntax"

I would agree that some sortof "WITH DROP_EXISTING" would be a nice approach
Posted by Microsoft on 12/3/2008 at 2:52 PM
Hi,
We understand your concern regarding the CREATE OR ALTER request. We value all customer feedback and sometimes a feature doesn't get into the product due to scoping/resources/priority. Just to give you an idea, we have over 2000 programmability requests to consider for the next version of SQL Server. For every reelease, we go through various scenarios, evaluate customer requests and come up with the features that can fit the schedule given the resources. Sometimes we make painful cuts and end up deferring a request to future.
Anyway, we are definitely evaluating adding the syntax for the next major version of SQL Server. One of the challenges is to decide which DDLs to support first. We cannot add CREATE OR ALTER for every single DDL since that will require lot of work and testing. We will look at scoping the syntax support and provide value to developers for the common scenarios. Hope this helps.

--
Umachandar, SQL Programmability Team
Posted by QingsongYao on 1/15/2009 at 8:07 PM
Hello, Guys
I think create or replace can works on two ways:
1) if object exist
            drop it
     create object
2) if object exist
            alter it
     else
            create it
This two have significant different. For example, if I have a function f1 which depends on function f2, then if I use create or replace for function f2, the case 1 will failed because the drop statement will be failed due to dependence checking. Also, no 2 have several advantage, such as the dependence, and permission is not changed, and object id is not changed as well. I personally think it is desirable. However, case 2 can only work with view, function, procedure, trigger, but I think it make sense too. If your guys have any opinion for this, please post it here.
    
Posted by Alex Kuznetsov on 5/24/2009 at 6:42 AM
One of those cases when a little change would make a huge difference.
Posted by Brian Tkatch on 7/23/2009 at 12:06 PM
This is a good idea.

Though ALTER is misleading. ALTER means to change something about the meta-data. Here the actual PROCEDURE is being replaced. Hence Oracle's CREATE OR REPLACE.

I'd suggest allowing REPLACE on its own, which would implicitly include CREATE. Or change OR to WITH: CREATE WITH REPLACE .