我想使用这样的存储过程创建或更新视图:
CREATE PROC Proc_Get_Ready_Weapons
AS
BEGIN
IF EXISTS(select * FROM sys.views where name = 'dbo.vwGetReadyWeapons')
BEGIN
EXEC ('CREATE VIEW dbo.vwGetReadyWeapons ... rest of view')
END
ELSE
BEGIN
EXEC ('CREATE OR REPLACE VIEW dbo.vwGetReadyWeapons ... rest of view')
END
IF @@ROWCOUNT = 0
PRINT 'Warning: No rows were updated'
END
但收到此错误:
消息 156,级别 15,状态 1,行 1
关键字“OR”附近的语法不正确。
警告:未更新任何行