Results 1 to 2 of 2

Thread: Comparing Two tables and updating as needed.

  1. #1
    Join Date
    May 2003
    Posts
    43

    Comparing Two tables and updating as needed.

    I have two tables in seperate dbs that I need to match up users and update the passwords in the second db table. I know how to match up the data and I'm sure I can do this using a cursor but I was wondering if there is a way I can do this with an update statement. Any suggestions(including telling me I'm stuck using a cursor) would be great.

    Thanks ahead of time


    EDIT: Nevermind, figured it out Thanks anyway.
    Last edited by DeadManWalking; 01-05-2004 at 09:25 AM.

  2. #2
    Join Date
    Mar 2003
    Location
    NJ
    Posts
    201
    update Table2 set
    Table2.Col1 = B.Col1,
    Table2.Col2 = B.Col2,
    Table2.Col3 = B.Col3,
    Table2.Col4 = B.Col4,
    Table2.Col5 = B.Col5,
    Table2.Col6 = B.Col6
    from Table2 A right outer join
    Table1 B on A.Col1 = B.Col1 where A.col1 is not null

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •