”无法绑定由多个部分组成的标识符“的问题

dragon_gxy 2008-04-16 03:30:00
创建触发器如下,希望能够用deleted表来实现级联删除,可是执行提示错误说:消息 4104,级别 16,状态 1,过程 autodetail,第 5 行
无法绑定由多个部分组成的标识符 "deleted.id"。

CREATE TRIGGER autodetail
ON fixture
AFTER delete
AS
delete from matchdetails where matchdetails.id=deleted.id
GO

请问是怎么回事,请高手指教!!
...全文
6737 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
AlwaysOnline 2011-07-13
  • 打赏
  • 举报
回复
454
sandyxfang 2010-06-24
  • 打赏
  • 举报
回复
恩,试试
liuluanqing 2010-03-24
  • 打赏
  • 举报
回复
delete 表名 from 表1,表2 where 连接字段
xiaoliaoyun 2008-04-16
  • 打赏
  • 举报
回复
也可以用下面的

delete matchdetails from deleted where matchdetails.id = deleted.id


楼主根本没有from deleted能在where用到这个表
例如:
select * from a,b where a.id = b.id
你会写成下面的语句吗?
select * from b where a.id = b.id
zhu_gx 2008-04-16
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 dragon_gxy 的回复:]
佩服!可以了,但是不太明白,为什么一定要用别名才可以识别呢?
[/Quote]


我也只知道要用别名,但是不知道为什么?

小梁 能回答一下不
liangCK 2008-04-16
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 dragon_gxy 的回复:]
佩服!可以了,但是不太明白,为什么一定要用别名才可以识别呢?
[/Quote]

是这样子,没办法。
dragon_gxy 2008-04-16
  • 打赏
  • 举报
回复
佩服!可以了,但是不太明白,为什么一定要用别名才可以识别呢?
liangCK 2008-04-16
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 zhu_gx 的回复:]
小梁 我服了你了
[/Quote]

谢谢。
zhu_gx 2008-04-16
  • 打赏
  • 举报
回复
小梁 我服了你了
liangCK 2008-04-16
  • 打赏
  • 举报
回复
delete m
from matchdetails m,deleted d
where m.id=d.id
zhu_gx 2008-04-16
  • 打赏
  • 举报
回复
liangCK 2008-04-16
  • 打赏
  • 举报
回复
delete from matchdetails ,deleted d where matchdetails.id=d.id 

34,593

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧