CREATE trigger tr_bookinfo_update on book7.dbo.bookinfo
after update
as
if update(bookname) or update(bookprice) or update(isbn) or update(hopemonthsell)
update forum.dbo.bookinfomarc set bookname=a.bookname,bookprice=a.bookprice,isbn=a.isbn,hopemonthsell=a.hopemonthsell
from bookinfo b,inserted a on b.bookid=a.bookid
试一下
after update
as
if update(bookname) or update(bookprice) or update(isbn) or update(hopemonthsell)
update forum.dbo.bookinfomarc set bookname=a.bookname,bookprice=a.bookprice,isbn=a.isbn,hopemonthsell=a.hopemonthsell
from bookinfo b,inserted a on b.bookid=a.bookid
试一下
改了前面没改后面
CREATE trigger tr_bookinfo_update on book7.dbo.bookinfo
after update
as
if update(bookname) or update(bookprice) or update(isbn) or update(hopemonthsell)
update forum.dbo.bookinfomarc set bookname=a.bookname,bookprice=a.bookprice,isbn=a.isbn,hopemonthsell=a.hopemonthsell
from bookinfo b,inserted a where b.bookid=a.bookid
for update
as
if update(bookname) or update(bookprice) or update(isbn) or update(hopemonthsell)
update forum.dbo.bookinfomarc set bookname=a.bookname,bookprice=a.bookprice,isbn=a.isbn,hopemonthsell=a.hopemonthsell
from bookinfo b,inserted a where b.bookid=a.bookid
after update
as
if update(bookname) or update(bookprice) or update(isbn) or update(hopemonthsell) update c set bookname=a.bookname,bookprice=a.bookprice,isbn=a.isbn,hopemonthsell=a.hopemonthsell
from bookinfo inner join inserted a on bookinfo.bookid=a.bookid
inner join forum.dbo.bookinfomarc c on ... --这里连接条件根据你的实际填写