Select and EXEC in a single statement – SQL server

I have a temp table in a SP. I insert some values into it. I will need to then EXEC a second SP by sending in the values from the temp table. I would rather avoid having to use local variables.

  Name VARCHAR(200).
  Code INT


  @Name = --Here I send the values from temp
  @Code =

  • Combiming two select statemen sql
  • How to increment a secondary sequence number in a `delete from … into` query?
  • Update data table according to C# list efficiently
  • Rounding issue in LOG and EXP functions
  • Bool types in Entity Framework+Oracle
  • SQL MAX of multiple columns?
  • 3 Solutions collect form web for “Select and EXEC in a single statement – SQL server”

    create an actual temp table #TempTable and not a @varibale table, and you can share it between parent and child stored procedures…

    You can’t, unless you’re on SQL Server 2008 which allows table data types. Which can be used as stored proc parameters.

    Otherwise frp SQL 2000/2005, for 10 rows in the temp table, you need loop through 10 inner stored proc calls.

    You could wrap it all in a single SP.

    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.