Reputation: 6132
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.
Upvotes: 15
Views: 62970
Reputation: 577
if you want to insert the entire column then you can do like
insert into table_name
select * from view_name
Upvotes: 13
Reputation: 8204
insert into mytable(c1, c2, c3, ...)
select c1, c2, c3, ... from myview
Upvotes: 3
Reputation: 43984
Insert Into dbo.MyTable (Col1, Col2,...)
Select Col1, Col2, ...
From dbo.MyView
Upvotes: 16