SQL2000判断触发器是否存在 SQL语句执行报错
ifnotexists(select*fromdbo.sysobjectswhereid=object_id(N'delpoinits')andOBJECTPROPERT...
if not exists
(select * from dbo.sysobjects where id = object_id(N'delpoinits') and OBJECTPROPERTY(id, N'IsTrigger') = 1)
我勒个去 我知道了 语句不全~~~ 后面应该接 begin ****** end 那么问问 begin end中间可以接创建表或触发器的语句不~~ 我去试试哈
*********-*--*-*-**-
if exists(select * from dbo.sysobjects where id = object_id(N'delpoints') and OBJECTPROPERTY(id, N'IsTrigger') = 2)
go
CREATE TRIGGER delpoints
ON GHXH_Customer
AFTER UPDATE
AS
BEGIN
update GHXH_Customer set points = 0 where name like '%零售顾客%'
END
还是有报错~~~消息 102,级别 15,状态 1,第 1 行
')' 附近有语法错误。~~~~~ 倒是可以创建上去
我勒个去 为什么 为什么必须加一个语句·~~ 我倒是成功了 为什么~~if exists (select * from sysobjects where id=object_id(N'delpoints') and objectproperty(id,N'IsTrigger')=2)
update GHXH_Customer set points = 0 where name like '%小明%'
go
CREATE TRIGGER delpoints ON GHXH_Customer AFTER UPDATE AS BEGIN update GHXH_Customer set points = 0 where name like '%小明%' END 展开
(select * from dbo.sysobjects where id = object_id(N'delpoinits') and OBJECTPROPERTY(id, N'IsTrigger') = 1)
我勒个去 我知道了 语句不全~~~ 后面应该接 begin ****** end 那么问问 begin end中间可以接创建表或触发器的语句不~~ 我去试试哈
*********-*--*-*-**-
if exists(select * from dbo.sysobjects where id = object_id(N'delpoints') and OBJECTPROPERTY(id, N'IsTrigger') = 2)
go
CREATE TRIGGER delpoints
ON GHXH_Customer
AFTER UPDATE
AS
BEGIN
update GHXH_Customer set points = 0 where name like '%零售顾客%'
END
还是有报错~~~消息 102,级别 15,状态 1,第 1 行
')' 附近有语法错误。~~~~~ 倒是可以创建上去
我勒个去 为什么 为什么必须加一个语句·~~ 我倒是成功了 为什么~~if exists (select * from sysobjects where id=object_id(N'delpoints') and objectproperty(id,N'IsTrigger')=2)
update GHXH_Customer set points = 0 where name like '%小明%'
go
CREATE TRIGGER delpoints ON GHXH_Customer AFTER UPDATE AS BEGIN update GHXH_Customer set points = 0 where name like '%小明%' END 展开
1个回答
展开全部
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询