views:

27

answers:

2

Hi I want to insert a table values from the same table is it possible?

Ex : I'm trying to insert like this

insert into emplyeee values (select # * from employee)

Thanks in advance

+3  A: 

leave out the value keyword:

insert into employee
select * from employee

Assuming there are no unique or primary key constraints of course.

Shannon Severance
+2  A: 

Yes you can:

insert into employee (Column1,Column2,Column3) 
select Column1,Column2,Column3 from employee

You should specify all the non-identity columns if you have an identity field, as you will not be allowed to insert the identity values explicitly.

My Other Me