How to create a table from select query result in SQL Server 2008
Use following syntax to create new table from old table in SQL server 2008
Select * into new_table from old_table
use SELECT...INTO
The SELECT INTO statement creates a new table and populates it with the result set of the SELECT statement. SELECT INTO can be used to combine data from several tables or views into one table. It can also be used to create a new table that contains data selected from a linked server.
Example,
SELECT col1, col2 INTO #a -- <<== creates temporary table
FROM tablename
- Inserting Rows by Using SELECT INTO
Standard Syntax,
SELECT col1, ....., col@ -- <<== select as many columns as you want
INTO [New tableName]
FROM [Source Table Name]