IF EXISTS(SELECT name FROM sysobjects
WHERE name = '过程名' AND type = 'P')
DROP PROCEDURE 过程名
GOcreate procedure 过程名 @@test varchar(100) output
as
declare @var varchar(100)
if ( cursor_status( 'global','emp_id_cursor') = -3)
begin
declare test_cursor cursor for
select StringA
from tableA
end
if(CURSOR_STATUS('global','test_cursor')>=0)
close test_cursor
if(CURSOR_STATUS('global','test_cursor')=-1)
open test_cursor
fetch test_cursor into @var
while (@@fetch_status <> -1)
begin
select @@test = @@test + @var
enddeclare @@string_total varchar(100)
execute 过程名 @@string_total outputupdate tableB
set stringB = @@string_total
go
WHERE name = '过程名' AND type = 'P')
DROP PROCEDURE 过程名
GOcreate procedure 过程名 @@test varchar(100) output
as
declare @var varchar(100)
if ( cursor_status( 'global','emp_id_cursor') = -3)
begin
declare test_cursor cursor for
select StringA
from tableA
end
if(CURSOR_STATUS('global','test_cursor')>=0)
close test_cursor
if(CURSOR_STATUS('global','test_cursor')=-1)
open test_cursor
fetch test_cursor into @var
while (@@fetch_status <> -1)
begin
select @@test = @@test + @var
enddeclare @@string_total varchar(100)
execute 过程名 @@string_total outputupdate tableB
set stringB = @@string_total
go
declare test_cursor cursor for
select StringA
from tableA
open test_cursor
fetch test_cursor into @var
while (@@fetch_status <> -1)
begin
select @@test = @@test + @var
end
帮我看看,如果不能帮忙up.