• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 742
  • Last Modified:

Create or Replace for Sql Server



What is equvialent of Create or Replace in Sql Server
0
N_Sri
Asked:
N_Sri
2 Solutions
 
mcv22Commented:
Can you give an example of what you are trying to do?
0
 
Kevin CrossChief Technology OfficerCommented:
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
 
N_SriAuthor Commented:
thankyou
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now