-- 判断要创建的视图名是否存在
if exists (select * from dbo.sysobjects where id =object_id(N'[dbo].[View_1]') and OBJECTPROPERTY(id, N'IsView') =1)
-- 删除视图
drop view [dbo].[View_1]
GO
--创建视图
CREATE VIEW View_1
AS
查询语句
go
-- 判断要创建的视图名是否存在
if exists (select * from dbo.sysobjects where id =object_id(N'[dbo].[View_1]') and OBJECTPROPERTY(id, N'IsView') =1)
-- 删除视图
drop view [dbo].[View_1]
GO
--创建视图
CREATE VIEW View_1
AS
查询语句
go