Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SELECT * INTO

Author  Topic 

chriztoph
Posting Yak Master

184 Posts

Posted - 2012-05-15 : 23:43:57
Hi Everyone,

I just need help for this:

	DECLARE @Query AS VARCHAR(MAX)
SET @Query= 'SELECT * FROM vwSample'

SELECT * INTO #Temp FROM <EXEC (@Query)>

SELECT * FROM #Temp



Other suggestions are welcome.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-16 : 00:18:20
you need to use OPENROWSET for this

see

http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/26/select-columns-from-exec-procedure-name-is-this-possible.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -