declare @bb int
DECLARE lsb1 CURSOR FOR
select * from zwqd
if @@rowcount>0
begin
set @bb=1
end
DEALLOCATE lsb1
select @bb现在@bb=1不起作用~~!游标是必须用的~~不知道怎么写了
DECLARE lsb1 CURSOR FOR
select * from zwqd
if @@rowcount>0
begin
set @bb=1
end
DEALLOCATE lsb1
select @bb现在@bb=1不起作用~~!游标是必须用的~~不知道怎么写了
SELECT LastName, FirstName FROM Northwind.dbo.Employees
OPEN Employee_Cursor
FETCH NEXT FROM Employee_Cursor
WHILE @@FETCH_STATUS = 0
BEGIN
FETCH NEXT FROM Employee_Cursor
END
CLOSE Employee_Cursor
DEALLOCATE Employee_Cursor
DECLARE lsb1 CURSOR FOR select 1 from zwqd
open lsb1
fetch lsb1 into @bb
while @@fetch_status=0
begin
set @bb=1
fetch lsb1 into @bb
end
close lsb1
DEALLOCATE lsb1
select @bb
set @bb=0
DECLARE lsb1 CURSOR FOR select 1 from zwqd
open lsb1
fetch lsb1 into @bb
while @@fetch_status=0
begin
set @bb=@bb+1
fetch lsb1 into @bb
end
close lsb1
DEALLOCATE lsb1
select @bb
create table tb1(id int)
insert into tb1 values(1)
insert into tb1 values(2)
insert into tb1 values(3)
insert into tb1 values(4)
insert into tb1 values(5)Create proc pp_ww
as
Begin
declare @t table (a int )
declare @tt int
declare cur_name cursor for select id from tb1
open cur_name
fetch cur_name into @tt
while @@fetch_status=0
begin
insert into @t select @tt
fetch cur_name into @tt
End
Close cur_name
deallocate cur_name
select * from @t
End
exec pp_ww
drop proc pp_ww
drop table tb1
'1
2
3
4
5
'