February 20, 2009 at 12:25 am
How to update multiple users, in multiple columns, and in multiple tables in a database at a time
By shekar811 in SQL Server 2005
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 Query : 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 ?
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.
February 20, 2009 at 12:30 am
Plz, don't do double posts! All reply should be here
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply