我在 lost表中插入一条记录时,在book表中删除一条记录.他们的公共属性是bookid
这样写,有语法错误,请教该怎么写?CREATE TRIGGER bookdelete ON Lost
FOR INSERT
AS
delete from book where book.bookid=inserted.bookid
这样写,有语法错误,请教该怎么写?CREATE TRIGGER bookdelete ON Lost
FOR INSERT
AS
delete from book where book.bookid=inserted.bookid
解决方案 »
- 一个数据模块 连接2个数据库
- Word的Com Add-in插件中的CommandBarButton的Click事件在delphi中怎么回传?在线等!
- 请问如果得到默认打印机中有多少打印文档???
- 关于ado的问题
- 反序列化回来错了呢?
- 为什么在table中会出现这样的问题,高手帮忙!
- Access2000中的一个字段是Teacher/Student,Table用到该字段就报错!我该怎么办?
- 一只小菜鸟的问题,还往高手知道
- 请教各位WINDOWS版本问题!
- delphi7 两个fsNormal 窗体 点击按钮 form1 关闭 form2打开 怎么写代码啊?
- 把一个外部的Exe放在一个form中执行!
- 控件Ehlib3安装时提示: File not found: 'DBSumLst.dcu',请问这是为什么??
before insert or update
on <table_name>
for each row
declare
<VARIABLE DECLARATIONS>
begin
<CODE>
exception
<EXCEPTION HANDLERS>
end <TRIGGER_NAME>;
ON Lost
FOR INSERT
AS
delete from book where book.bookid in (select bookid from lost.bookid)--这里到底是删---除lost表还是inserted表,楼主自己换GO
上面好像有Oralce的语法吧.
也可以在程序中用代码写SQL语句来删除
FOR insert
AS
begin
declare @bookid varchar(4)
select @bookid=bookid from inserted -- ‘inserted ' 这个表是系统自动建立的表,表结构和建立触发器的表结果一致
delete from book where bookid =@bookid
end