Update question

  • Hello All,

    My question is:

    I am planning to create a stored procedure to update several tables on DB2 from DB1 that only has one table. DB1 resides on the same server as DB2. As stated earlier DB1 has one table with 46 feilds(columns). The 46 feilds(columns) need to update different tables on DB2. Feild names are different on DB's.

    DB1

    memberID

    FirstName

    LastName

    MiddleName

    etc..

    DB2

    member.FN

    member.LN

    member.ID

    member.WN

    update member set WN = FirstName + ' ' + LastName

    from db1.dbo.MemberEnrollment

    where db2.dbo.member.ID = db1.dbo.MemberEnrollment.memberID

    Would I have to write 46 update statements in the sproc or could I handle this differently?

    Thanks all,

    DA

  • If all the 46 fields go to 46 different tables in DB2 then yes you would write 46 different update statements. You could group updates to multiple fields from same table into one update statement. Hope I made sense.

    ******************
    Dinakar Nethi
    Life is short. Enjoy it.
    ******************

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

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