1

I have two tables table1 with fields f1, f2

and

table2 with fields id,f1,f2, where id is incremental field

I need to take the values from table1 and need to insert into table2

Can anyone give the query for that,in sql server

1
  • 2
    Really need to accept more answers.... Commented May 4, 2011 at 16:40

3 Answers 3

1
INSERT INTO table2(f1,f2) SELECT f1,f2 FROM table1

That will do exactly what you want.

Sign up to request clarification or add additional context in comments.

Comments

0
INSERT INTO table2
    (f1, f2)
    SELECT f1, f2
        FROM table1

Comments

0

Check out select into or insert into

http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.