2

How do I get the stored procedure result set into temp table without creating temp Table.

Also I did not use Openrowset command.Please help.I want like this

insert * into #tab
exec Tet1.dbo.Proc_GeSpecific @dataToPass 
Jithin Shaji
  • 5,893
  • 5
  • 25
  • 47
Neeraj Dubey
  • 4,401
  • 8
  • 30
  • 49
  • As a matter of good practice, you **should** always strongly type your temporary tables through a `CREATE TABLE #tempTable` statement. – Chris Pickford Sep 02 '14 at 09:43

1 Answers1

0

Here is the syntax to use in order to insert result of a stored procedure into a temp table:

INSERT #table(column1, column2,...)
EXEC Tet1.dbo.Proc_GeSpecific @dataToPass

Hope this will help you.

Joël Salamin
  • 3,538
  • 3
  • 22
  • 33
  • 2
    This is not a solution, he is asking if it is possible to do it without creating the table before – DarioN1 Oct 18 '19 at 08:15
  • The proposed solution is inserting the result of the stored procedure into a temporary table. The temporary table isn't created before the stored procedure execution. The alternative with table creation would be starting with `CREATE TABLE #table ...` – Joël Salamin Oct 21 '19 at 08:58