Solved

Create or Replace for Sql Server

Posted on 2011-02-17
3
726 Views
Last Modified: 2012-05-11


What is equvialent of Create or Replace in Sql Server
0
Comment
Question by:N_Sri
3 Comments
 
LVL 12

Assisted Solution

by:mcv22
mcv22 earned 100 total points
ID: 34922607
Can you give an example of what you are trying to do?
0
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 400 total points
ID: 34922641
There is no equivalent; therefore, you will need to DROP the original object and CREATE it again.

For example, here is a view:
IF OBJECT_ID (N'{your object name here}') IS NOT NULL
   DROP VIEW {your object name here}
GO

CREATE VIEW {your object name here}
AS ...

Open in new window


OR
IF OBJECT_ID (N'dbo.VW_Something') IS NOT NULL
   DROP VIEW dbo.VW_Something
GO

CREATE VIEW dbo.VW_Something
AS ...

Open in new window

0
 

Author Closing Comment

by:N_Sri
ID: 34930275
thankyou
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now