Create Table from View
SQL Server
does not support CREATE TABLE AS SELECT
.
Use this:
SELECT *
INTO A
FROM myview
or
SELECT TOP 10
*
INTO A
FROM myview
ORDER BY
id
If you just want to snag the schema and make an empty table out of it, use a false predicate, like so:
SELECT * INTO myNewTable FROM myView WHERE 1=2
In SQL SERVER you do it like this:
SELECT *
INTO A
FROM dbo.myView
This will create a new table A
with the contents of your view.
See here for more info.
To create a table on the fly us this syntax:
SELECT *
INTO A
FROM dbo.myView
If you want to create a new A
you can use INTO
;
select * into A from dbo.myView