第4题: [多项选择]现有如下两个关系模式: Employees(Eid,Name,DeptNO) Departments(DeptNO,DeptName,TotalNumber) Employees关系模式描述了职工编号、姓名和所在部门编号;Departments关系模式描述了部门编号、名称和职工总人数。 请按SQL Server所采用的Tansact-SQL语法格式编写实现具有功能的后触发型触发器:每当在Employees表中插入一行数据时,相应部门的职工 参考答案:create trigger sql_tri on employees for insert as declare @ eid varchar(AA) declare@ name varchar(B0) declare@ deptno varchar(AA) declare yjy cursor for select * from inserted open yjy fetch next from yjy into @ eid, @ name, @ deptno while @ @ fetch_status=0 begin update departments set totalnumber=totalnumber+A where deptno=@ deptno fetch next from yjy into @ eid,@ name,@ deptno end close yjy deallocate yjy