troubleshooting Question

How to get the cte content into temp table inside the procedure

Avatar of KavyaVS
KavyaVS asked on
Microsoft SQL Server 2008
10 Comments6 Solutions437 ViewsLast Modified:
I created a stored procedure in Sql 2008R2.It has common table expression inside the procedure.
Create procedure dbo.usp_GetDetails as BEGIN

With cteDetails(ID,FIRST,Middle,Last,BIRTHDATE,Address)
 From dbo.V_Details)
select *
into #tempcte
from cteDetails

I am trying to take everything in the cte to temp table using
select *
into #tempcte
from cteDetails

But nothin in th temp table.
Same thing giving the details in query analyzer.
How to get it work in the procedure.


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 6 Answers and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 6 Answers and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros