从Sproc中执行SProc(使用传入的参数)

时间:2021-03-16 02:05:15

Does anyone know of a way to execute a stored procedure from within a stored procudure using some of the params passed in from the original procedure.

有没有人知道使用从原始过程传入的一些参数从存储过程中执行存储过程的方法。

i.e. if i pass in params @id, @event date, @ log into sproc 1 then sproc 1 will do it's own stuff and pass in @log and @event_date to sproc 2.

即如果我传入params @id,@ event date,@ log into sproc 1,那么sproc 1会自己做东西并将@log和@event_date传递给sproc 2。

Thanks!

3 个解决方案

#1


Just execute the second sp the same way you would have from a query.

只需像查询一样执行第二个sp。

EXEC SPROC2 @LOG, @EVENT_DATE

#2


just call:

exec mysproc @param1 @param2

exec mysproc @ param1 @ param2

inside your sproc.

你的内心。

#3


call exec with the parameters of interest:

使用感兴趣的参数调用exec:

  ... within sp_1
  ... other code
  exec sp_2 @log, @event_date

#1


Just execute the second sp the same way you would have from a query.

只需像查询一样执行第二个sp。

EXEC SPROC2 @LOG, @EVENT_DATE

#2


just call:

exec mysproc @param1 @param2

exec mysproc @ param1 @ param2

inside your sproc.

你的内心。

#3


call exec with the parameters of interest:

使用感兴趣的参数调用exec:

  ... within sp_1
  ... other code
  exec sp_2 @log, @event_date