问题:在SQLserver中如何访问指定行的数据?
这里就要使用到了游标的概念?给大家推荐一位大佬的写的文章
http://www.cnblogs.com/moss_tan_jun/archive/2011/11/26/2263988.html
代码:
declare test_cursor cursor scroll for
select * from ScoreMsg
open test_cursor
declare @StudentNo int, @CourseId int,@Score int //定义三个变量
fetch absolute 1 from test_cursor --into @StudentNo,@CourseId,@Score //这里面的1指的就是我们要直接访问的行
print @StudentNo
print @CourseId
print @Score
close test_cursor deallocate test_cursor
运行截图: