用游标。
--先定义
declare @fld varchar(30)
declare cur_name cursor for
select [要获取值的列] from tablename where 指定条件
--再打开
open cur_name
--获取值 一行一行地读取结果集
fetch next from cur_name into @fld
while @@fetch_status =0
begin
fetch next from cur_name into @fld
end
--先定义
declare @fld varchar(30)
declare cur_name cursor for
select [要获取值的列] from tablename where 指定条件
--再打开
open cur_name
--获取值 一行一行地读取结果集
fetch next from cur_name into @fld
while @@fetch_status =0
begin
fetch next from cur_name into @fld
end
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货