SQL Server : copy data from one table to another

Posted by Gladdy on Stack Overflow See other posts from Stack Overflow or by Gladdy
Published on 2012-10-25T21:40:41Z Indexed on 2012/10/26 5:01 UTC
Read the original article Hit count: 66

Filed under:

I want to update Table2 names with names from Table1 with matching Ids

I have around 100 rows in each table.

Here is my sample tables.

Table1

  • ID
  • Name

Table2

  • ID
  • Name

Sample data

Table1

    ID |Name
    --------
     1 |abc
     2 |bcd

Table2

    ID |Name
    --------
     1 |xyz
     2 |OOS

Expected result

Table2

    ID |Name
    --------        
     1 |abc
     2 |bcd

How can I do this?

© Stack Overflow or respective owner

Related posts about sql-server