seven_cmseven_cmseven_cm SqlServer

1、创建存储过程

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Create proc proc_name
as
declare @supp_cursor cursor;

declare
@EnName varchar(40),
@SupplierStatus int;

set @supp_cursor = cursor for
select [EnName]
,[SupplierStatus]
FROM [XXX_TABLE];

open @supp_cursor
fetch next from @supp_cursor
into
@EnName ,
@SupplierStatus;
while(@@FETCH_STATUS=0)
begin
print 'DbKey:' + convert(varchar,@DbKey);

fetch next from @supp_cursor
into
@EnName ,
@SupplierStatus ;
end
close @supp_cursor;

deallocate @supp_cursor;