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

  • 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 ?

    Simple Query:

    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.

  • Plz, don't do double posts! All reply should be here

    http://www.sqlservercentral.com/Forums/FindPost661081.aspx

    ============================================================
    SELECT YOUR PROBLEM FROM SSC.com WHERE PROBLEM DESCRIPTION =
    http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]

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

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