存储过程、触发器的例子.doc

时间:2023-08-22 10:55:57
【文件属性】:

文件名称:存储过程、触发器的例子.doc

文件大小:650KB

文件格式:DOC

更新时间:2023-08-22 10:55:57

数据库原理 数据库设计 王珊 大学课程 数据库概论

存储过程: 1.CREATE PROCEDURE loving AS BEGIN SELECT * from student where ssex='女' END: 执行 Exec loving 2. CREATE PROCEDURE loving1 as BEGIN SELECT * from student end 3. CREATE PROCEDURE pr1_sc_ins @Param1 char(10),@Param2 char(2),@Param3 real AS BEGIN insert into sc(sno,cno,grade) values(@Param1,@Param2,@Param3) END 执行: EXEC pr1_sc_ins '200215121','4',85或 EXEC pr1_sc_ins @Param1='200215121',@Param2='6', @Param3=85 4. CREATE PROCEDURE s_grade @sname char(8),@sgrade real output AS SELECT @sgrade =grade from sc join student on student.sno=sc.sno where sname=@sname 执行: DECLARE @sgrade real EXEC s_grade @sname = '李勇', @sgrade = @sgrade OUTPUT


网友评论