This question already has an answer here:
I want to create a table from select query result in SQL Server, I tried
create table temp AS select.....
but I got an error
Incorrect syntax near the keyword 'AS'
This question already has an answer here:
I want to create a table from select query result in SQL Server, I tried
create table temp AS select.....
but I got an error
Incorrect syntax near the keyword 'AS'
use
SELECT...INTO
Example,
Standard Syntax,
Try using SELECT INTO....
Select [Field Names] into [New Table] from [Source Table]
Use following syntax to create new table from old table in SQL server 2008
Please be careful, MSSQL:
"SELECT * INTO NewTable FROM OldTable"
is not always the same as MYSQL:
"create table temp AS select.."
I think that there are occasions when this (in MSSQL) does not guarantee that all the fields in the new table are of the same type as the old.
For example :
does not always yield:
but may be:
Please try: