SQL 使用视图插入表格

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3068633/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 06:35:44  来源:igfitidea点击:

Insert into a table using a view

sql

提问by Hyman Mills

I have some data in a view which I want to insert into a table (same table schema) what's the easiest, cleanest way to do it.

我在视图中有一些数据,我想将其插入表(相同的表架构)中,这是最简单、最干净的方法。

回答by codingbadger

Insert Into dbo.MyTable (Col1, Col2,...)
Select Col1, Col2, ...
From dbo.MyView

回答by Ashim Sinha

if you want to insert the entire column then you can do like

如果你想插入整列,那么你可以这样做

   insert into table_name
   select * from view_name

回答by Willis Blackburn

insert into mytable(c1, c2, c3, ...)
select c1, c2, c3, ... from myview