在一个存储过程中,怎样批量执行另一个存储过程?比如执行一个存储过程 sp_Testexec dbo.sp_Test
@userId=1我想要一个效果,批量执行这个存储过程
比如用户表 UserTable(utid int)我虚幻的效果就是 select (exec dbo.sp_Test @userId=UserTable.utid) from UserTable请问可以吗?或者类似的解决方法
@userId=1我想要一个效果,批量执行这个存储过程
比如用户表 UserTable(utid int)我虚幻的效果就是 select (exec dbo.sp_Test @userId=UserTable.utid) from UserTable请问可以吗?或者类似的解决方法
returns int
as
begin
return @i+1
end
go
create table tb(i int)
insert into tb select 1
insert into tb select 2
insert into tb select 3select i,dbo.fname(i) from tb 1 2
2 3
3 4
create procedure aaa
as
declare @b int
select @b = [id] from Table_1 where id=170
return @bgo --测试存储过程
declare @b int
exec @b= aba
print @b