Home >Database >Mysql Tutorial >How to Correctly Create a Table from SELECT Query Results in SQL Server 2008?
Creating a Table from SELECT Query Results in SQL Server 2008
Encountering the "Incorrect syntax near the keyword 'AS'" error while trying to create a table using CREATE TABLE temp AS SELECT ...
in SQL Server 2008? This signifies an incompatibility with the syntax.
The correct approach in SQL Server 2008 involves this syntax:
<code class="language-sql">SELECT * INTO new_table FROM old_table;</code>
This command generates a new table named "new_table," mirroring the structure and data of "old_table." Importantly, "old_table" remains unchanged.
The above is the detailed content of How to Correctly Create a Table from SELECT Query Results in SQL Server 2008?. For more information, please follow other related articles on the PHP Chinese website!