SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SELECT * INTO
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

chriztoph
Posting Yak Master

Philippines
155 Posts

Posted - 05/15/2012 :  23:43:57  Show Profile  Reply with Quote
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.

Edited by - chriztoph on 05/15/2012 23:45:51

visakh16
Very Important crosS Applying yaK Herder

India
47023 Posts

Posted - 05/16/2012 :  00:18:20  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000