正文

SQL数据库上机语言集合2006-10-16 15:12:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/sword2008/19376.html

分享到:

游标:

use teaching
go
declare student_cursor1 cursor
for select *
    from student

go
declare student_cursor2 cursor

for select suo,sname
 from student
 where dept='324'
 order by sno
for read only
go

打开游标等操作:

use teaching
go
declare student_cursor4 cursor

for select ok,ko
 from sword
 where do='1'
 order by ok
for read only
go

open student_cursor4
use teaching
go
declare @ko varchar(7),@ok varchar(20)
fetch next from student_cursor4
into @ok,@ko

while @@fetch_status=0
begin
print @ok+@ko
fetch next from student_cursor401
into @ko,@ok
end
close student_cursor4
deallocate student_cursor4

go 

 

 

 

存储过程:

CREATE PROCEDURE student_info  @ok varchar(20)
AS select ok,ko,do
from sword

where ok=@ok
GO

阅读(3125) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册