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 2000 Forums
 SQL Server Development (2000)
 Creating table from query-result?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-06-17 : 19:24:54
Asbjørn Mikkelsen writes "Is it possible to create an temporary table based on the result of an query?

Create Table #test (
SELECT a, b FROM testdata
)

The point is that I have one sp that generates various temptables based on one input parameter, and later in the sp I fill this temptable with data that is returned.
I use temptables becouse I beleive it is faster that operating on the resultset since I use this table lots of places afterwards.

And the reason to have the table auto-generated based on the query is that it is difficult to update the correct field-types and such when I update the fieldtypes of the table that the data is selected from later."
   

- Advertisement -