Solved

Create or Replace for Sql Server

Posted on 2011-02-17
3
727 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sql Query 4 38
Error in SSIS while executing  - Potential data loss 4 24
SSRS 2012 r2 - Parm Drop Down has Date/Time 12 33
Help Required 3 97
Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

773 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