CREATE OR REPLACE VIEW
doesn't seem to work in SQL Server. So how do I port CREATE OR REPLACE VIEW
to work on SQL Server?
This is what I'm trying to do:
CREATE OR REPLACE VIEW data_VVVV AS
SELECT
VCV.xxxx,
VCV.yyyy AS yyyy,
VCV.zzzz AS zzzz
FROM
TABLE_A
;
Any ideas?
Borrowing from @Khan's answer, I would do:
IF OBJECT_ID('dbo.test_abc_def', 'V') IS NOT NULL
DROP VIEW dbo.test_abc_def
GO
CREATE VIEW dbo.test_abc_def AS
SELECT
VCV.xxxx
,VCV.yyyy AS yyyy
,VCV.zzzz AS zzzz
FROM TABLE_A