日期:2014-05-18  浏览次数:20411 次

请问我的触发器怎么编译不过?总是提示说“无法绑定由多个部分组成的标识符 "Session.CreateTime"”
CREATE TRIGGER CheckSessionStatus_DELETE
ON [Session]
FOR DELETE
AS
if DateDiff(minute, DateAdd(minute, 20, [Session].CreateTime), getdate()) > 0
  delete from [Session] where ID=(select ID from deleted)

------解决方案--------------------
SQL code
delete from [Session] where ID in (select ID from deleted)

------解决方案--------------------
SQL code
CREATE TRIGGER CheckSessionStatus_DELETE
ON [Session]
FOR DELETE
AS
delete from [Session] 
where  DateDiff(minute, DateAdd(minute, 20, [Session].CreateTime), getdate()) > 0
and ID in(select ID from deleted)