I have a view that I want to create a table from in SQL Enterprise Manager, but I always get an error when I run this query:
CREATE TABLE A
AS
(SELECT top 10 FROM dbo.myView)
So far the error is: "syntax error at 'as'"
View is too large. Is it possible to use a top 10?
Looks a lot like Oracle, but that doesn't work on SQL Server.
You can, instead, adopt the following syntax...
If you just want to snag the schema and make an empty table out of it, use a false predicate, like so:
In SQL SERVER you do it like this:
This will create a new table
A
with the contents of your view.See here for more info.
INSERT INTO table 2 SELECT * FROM table1/view1
To create a table on the fly us this syntax: