Need some help with something

  • I have two tables that are pretty much identical.

    I would like to be able to create a stored procedure that will look at the company name in Table 1and if the company name in table2 is the same then copy the accountID from table1 to table2

    anyone know how to do this?  I just need a sample.  I have to do some more manipulation to the data just not thinking straight right now.

    I wouldn't normally do this but it's for a data migration task I need to perform and I am a little brain dead at this point

  • Simply something like this.

     

    Update

    T2

    SET

    AccountID = T1.AccountID

    FROM

    Table2 T2

    INNER JOIN

    Table1 T1

    ON

    T2.CompanyName = T1.CompanyName

  • Thank you,  I thought that would work and it did beautifully.  Much and many thanks.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply