Exec in Sp and returning recordset

  • Thread starter Thread starter Jeff Davies
  • Start date Start date
J

Jeff Davies

Guys,
I am trying to Execute the following in a stored proc.

exec spCreateTmpTable @Param1, @Param2

SELECT TOP 100 PERCENT dbo.tblCustomers.*
FROM dbo.tblCustomers INNER JOIN
dbo.TmpTable ON dbo.tblCustomers.ID = dbo.TmpTable.ID


These two things work fine individually.
spCreateTmpTable creates the Temp Table and fills it with appropriate data.

The Select SQL will then happily work in a view,
but when I try and run them both in the one SP, I get no records returned.
What am I missing?
Thanks in advance,
Jeff
 
The first SP calls the second which creates the Temp table, Right? If
that is the case the Temp table goes away when the called SP finishes
executing...
 
Thanks Craig, but the table is not a # table and stays permanently.
That is not the problem.
The table is certainly available after the first sp runs.
Any other ideas?
J
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top