I can't really think of the best way to phrase this question, so I'll just give an example. Suppose I have a table that is created like this:
CREATE VIEW People
AS
SELECT
id, --int
name, --varchar(20)
birthdate --datetime
FROM SomeTable
If I wanted to change this from a view to a physical table, is there any way to create a table with the same layout?
In other words, I want to take that view and create a table like this:
CREATE TABLE People(
id int,
name varchar(20),
birtdate datetime
)
...but without having to manually write that query out.
This is of course a contrived example. The view has a lot of fields with a lot of different data types, so it would be difficult to do by hand.
How about
SELECT * INTO MyNewTable FROM MyView
AND if you don't want the content, just the structure
SELECT * INTO MyNewTable FROM MyView WHERE 1 = 2
SELECT *
INTO People_Table
FROM People_View
选择* INTO PeopleTable FROM People
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.