sql
CREATE TRIGGER repairtrigger ON repairform
FOR INSERT
AS
BEGIN
DECLARE@dor_id INT,@product_id VARCHAR(100);
SELECT@dor_id=dor_id,@product_id=product_id
FROM inserted
IF EXISTS
(
SELECT * FROM stu_information AS S,products AS P
WHERE S.dor_id=P.dor_id AND S.stu_id=@stu_id AND P.product_id=@product_id
)
BEGIN
print'报修单合格';
END
ELSE
BEGIN
print'报修单不合格';
ROLLBACK ;
END
END
5 queries executed, 1 success, 4 errors, 0 warnings
查询:create trigger repairtrigger on repairform for insert as begin declare@dor_id int,@product_id VARCHAR(100)
错误代码: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'on repairform
for insert
as
begin
declare@dor_id int,@product_id VARCHAR(100)' at line 1
执行耗时 : 0 sec
传送时间 : 0 sec
总耗时 : 0 sec
查询:select@dor_id=dor_id,@product_id=product_id from inserted if exists ( select * from stu_information as S,products as P where S.d
错误代码: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'if exists
(
select * from stu_information as S,products as P
where S.dor_id' at line 3
执行耗时 : 0 sec
传送时间 : 0 sec
总耗时 : 0 sec
查询:end else begin print'报修单不合格'
错误代码: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'end
else
begin
print'报修单不合格'' at line 1
执行耗时 : 0 sec
传送时间 : 0 sec
总耗时 : 0 sec
错误代码: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'end
end' at line 1
执行耗时 : 0 sec
传送时间 : 0 sec
总耗时 : 0 sec