use BookDB
go
drop procedure aaa_proc;
go
create procedure aaa_proc
as
begin
declare cur_a1 cursor for
SELECT TOP (1000) [dictypecode] ,[diccode]
FROM [BookDB].[dbo].[D_DICDETAIL];
open cur_a1;
declare @dictypecode varchar(100),@diccode varchar(100);
fetch next from cur_a1 into @dictypecode,@diccode;
while @@FETCH_STATUS=0
begin
print 'dictypecode:'+ @dictypecode+' diccode:'+ @diccode;
fetch next from cur_a1 into @dictypecode,@diccode;
end
close cur_a1;
deallocate cur_a1;
end;
exec aaa_proc
--返回值
use BookDB
go
drop procedure proc_aabb;
go
create procedure proc_aabb @cc int out
as
begin
set @cc=1;
end;
go
declare @cc int
exec proc_aabb @cc out
print @cc