declare customer_cur scroll cursor
for select * from customers
open customer_cur
print @@cursor_rows
declare @CompanyName nvarchar(40)
fetch next from customer_cur into @CompanyName --这里我只想用其中的一列,可以这样用吗?
while @@fetch_status=0
begin
print @companyname
fetch next from customer_cur into @CompanyName
end我想在游标里取出其中的一列,在上面已经写明我的目的,请问这样可以吗?
for select * from customers
open customer_cur
print @@cursor_rows
declare @CompanyName nvarchar(40)
fetch next from customer_cur into @CompanyName --这里我只想用其中的一列,可以这样用吗?
while @@fetch_status=0
begin
print @companyname
fetch next from customer_cur into @CompanyName
end我想在游标里取出其中的一列,在上面已经写明我的目的,请问这样可以吗?
declare customer_cur scroll cursor
for select CompanyNamefrom customers
open customer_cur
print @@cursor_rows
declare @CompanyName nvarchar(40)
fetch next from customer_cur into @CompanyName --这里我只想用其中的一列,可以这样用吗?
while @@fetch_status=0
begin
print @companyname
fetch next from customer_cur into @CompanyName
end
for select CompanyName from customers --列的列表和你的fetch对应
open customer_cur
print @@cursor_rows
declare @CompanyName nvarchar(40)
fetch next from customer_cur into @CompanyName --这里我只想用其中的一列,可以这样用吗?
while @@fetch_status=0
begin
print @companyname
fetch next from customer_cur into @CompanyName
end
--这里改一下,指定你要的列名******************
for select colname from customers
--***********************************
open customer_cur
print @@cursor_rows
declare @CompanyName nvarchar(40)
fetch next from customer_cur into @CompanyName --这里我只想用其中的一列,可以这样用吗?
while @@fetch_status=0
begin
print @companyname
fetch next from customer_cur into @CompanyName
end