日期:2014-05-19  浏览次数:20411 次

关于存储过程的问题
我想写一个存储过程用来调用另一个存储过程

我不会存储过程的格式和语法,大家帮我写一个好吗

满足条件就调用另一个存储过程

select   *   from   abc   where   id   = '1 '

很简单的,大家帮忙吧

------解决方案--------------------
create proc procname
(@test varchar(200)
)
as

if exists(select * from tb where colname=@test)
begin
exec procname2
end
------解决方案--------------------
带游标的存储过程
CREATE PROCEDURE xx AS
declare
@userid nvarchar(50)
declare cur CURSOR for SELECT Userid FROM TEST
open cur
FETCH NEXT FROM cur into @userid
while @@fetch_status =0
begin
print @userid
FETCH NEXT FROM cur into @userid
end
close cur
deallocate cur
GO