用游标。
--先定义
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