user3872646
user3872646

Reputation: 13

Copy first and second rows from table to another?

How can I copy from first and second rows only specific fields from one table to another table in C#?

insert into table1 select colum1, column2,... from table2

Upvotes: 0

Views: 114

Answers (3)

Hardik Gondalia
Hardik Gondalia

Reputation: 3717

Try this :

 insert into Table1 (Column1,Column2,..) select Top 2 Column1,Column2 From Table2

Upvotes: 0

samy
samy

Reputation: 14962

Assuming it's SQL, you can use the TOP statement on your source query

Upvotes: 1

Brij Raj Singh - MSFT
Brij Raj Singh - MSFT

Reputation: 5113

you have answered the question to an extent already

insert into table1 select colum1, column2,... from table2

you can use static values if you wish in the select statement, or change the column names

INSERT INTO table_name (column1,column2,column3,...)
VALUES (value1,value2,value3,...);

use the top statement, to pick top 2 rows, or if its mysql use the limit keyword to fetch top 2 rows.

Upvotes: 0

Related Questions