.NET+SQL SERVER 2000图书管理系统流程图+功能图+ER+全套设计论文 第6页
CREATE TABLE manage
(
manageid int(4) NOT NULL UNIQUE,
Pass char(10)
) ;
CREATE TABLE users
(
userid int(4) NOT NULL UNIQUE ,
username char(10) ,
pass char(10) ,
email char(50) ,
phone char(10) ,
address varchar(50) ,
BookNum int(4)
);
GO
4.8 创建触发器
创建关于书号和用户号的触发器,分别在BOOKINFO .USERS中修改bookid和userid时,在LENDINFO中也会有相应的修改。
CREATE TRIGGER BookidChange
ON BOOKINFO
AFTER UPDATE
AS
IF UPDATE(bookid)
BEGIN
DECLARE @book_id as int
DECLARE @old_book_id as int
SELECT @ book_id=bookid inserted
SELECT @ old_book_id =bookid deleted
Update LENDINFO
SET LENDINFO.bookid=@ book_id
WHERE LENDINFO. bookid =@ old_book_id
END
CREATE TRIGGER UserIdChanges
ON USERS
AFTER UPDATE
AS
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>