Jack Mills
Jack Mills

Reputation: 6132

Insert into a table using a view

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

Answers (3)

Ashim Sinha
Ashim Sinha

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

Willis Blackburn
Willis Blackburn

Reputation: 8204

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

Upvotes: 3

codingbadger
codingbadger

Reputation: 43984

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

Upvotes: 16

Related Questions