How to update multiple users, in multiple columns, and in multiple tables in a database at a time

  • Hi All,

    I have a problem with the USERIDs in my tables. Initially there are USERIDs named as 'rex.arnold' in many columns in a single table and with the same userid there multiple tables. we have 800+ tables and 80 columns per table. This userid will be in max of 5 to 11 columns for single table.

    Now i want to update many userids in many tables and in multiple columns at a time. is that possible to update userids at a time instead finding / searching the userid for each table and updating manually ? hope it goes days in updating ... 🙁

    Example:

    USERID: 'rex.arnold' must be changed to 'rexarnold' in multiple tables, in multiple columns.

    wherever it looks as 'rex.arnold' must be updated to'rexarnold'

    Sample Qeury : By this we can perform only on a single table (GlobalInbox) and for different columns for single USER. We can't check for all the tables and columns to write a query right ?

    update GlobalInbox set senderId='rexarnold', Recipientid='rexarnold' , Requestfor ='rexarnold' , createdby='rexarnold'where senderId='rex.arnold' or Recipientid='rex.arnold' or Requestfor ='rex.arnold' or createdby='rex.arnold'

    Help me out........ as am blocked in searching...!!! 🙁

    Thanks in advance.

    Maddy.

  • Please don't cross post. It just wastes peoples time and fragments replies. Was it really necessary to post this five times?

    No replies to this thread please. Direct replies to: http://www.sqlservercentral.com/Forums/Topic661081-146-1.aspx

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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