创建触发器出的语法错误!求大神解答!
sql吧
全部回复
仅看楼主
level 2
创建触发器出的语法错误!求大神解答!
2018年03月21日 03点03分 1
level 2
CREATEtrigger books_in
on BooksIN
for insert
as
declare @bID int,@num int
/*@bID:入库的图书ID, @num:入库数量 */
select @bID=bookID,@num= num from inserted
/*判断库存表中是否存在当前入库的图书*/
if exists(select * from BooksStorage where bookID=@bID)
/*存在,修改原记录*/
update BooksStorage
set storage= storage +@num
where bookID=@bID
else
/*没有,插入新记录*/
insert BooksStorage(bookID, storage)
values(@bID,@num)
2018年03月21日 04点03分 2
此楼为代码
2018年03月21日 04点03分
level 1
你找到解决方法了吗 我也是 着急
2018年03月28日 08点03分 3
1