一、循环结果集
SELECT * FROM Person.vAdditionalContactInfo
--游标(这里也可选择多个字段)
DECLARE c1 CURSOR FOR SELECT h.FirstName,h.LastName
FROM Person.vAdditionalContactInfo h;
DECLARE @fn VARCHAR(20),@ln VARCHAR(20)
Open c1
Fetch c1 into @fn,@ln
WHILE @@fetch_status=0 --获取游标成功
BEGIN
PRINT @fn
PRINT @ln
Fetch c1 into @fn,@ln
END
CLOSE c1
DEALLOCATE c1