Create Table from View Create Table from View sql sql

Create Table from View


SQL Server does not support CREATE TABLE AS SELECT.

Use this:

SELECT  *INTO    AFROM    myview

or

SELECT  TOP 10        *INTO    AFROM    myviewORDER 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 AFROM dbo.myView

This will create a new table A with the contents of your view.
See here for more info.