Results 1 to 2 of 2
  1. #1
    Join Date
    May 2004

    Do a SQL server wide UPDATE for all tables?


    Does anyone know if its possible to:

    1) Search for all tables ending with the name ending with "_users" under all databases (executed by the root user in phpmyadmin)

    2) In this list of tables, search for all records where the field user_login = "xyz"

    3) UPDATE these records, set the user_login field to be = user_nicename field and set the user_pass = MD5('abcxyz')

    "The problem with me & French is, you only say half the letters and I never know which half."

  2. #2
    Join Date
    Dec 2003
    Since your WHERE condition is always same
    SET user_login field = user_nicename, 
    user_pass = MD5("abcxyz") WHERE user_login = "xyz"
    you can run following query first to come up with list of queries

    SELECT CONCAT( 'UPDATE ' , table_name,' SET 
    user_login = user_nicename, 
    user_pass = MD5("abcxyz") WHERE 
    user_login = "xyz"' ) FROM information_schema.tables 
        WHERE table_name LIKE '%_user';
    and then run the resulting queries
    Primary email: advanced dot programmer at gmail dot com ..

Similar Threads

  1. Update Tables On Website
    By jonessc in forum Design Requests
    Replies: 5
    Last Post: 03-29-2012, 01:31 PM
  2. compressing sql tables ?
    By jjk2 in forum Programming Discussion
    Replies: 3
    Last Post: 04-08-2009, 03:11 PM
  3. How to repair SQL tables?
    By cfaice in forum Hosting Security and Technology
    Replies: 14
    Last Post: 01-01-2006, 01:05 PM
  4. SQL Count from 2 tables?
    By ChrisF79 in forum Programming Discussion
    Replies: 4
    Last Post: 11-01-2005, 06:46 AM
  5. Arghhh... exporting MS SQL tables to new server...
    By spiceman in forum Web Hosting Lounge
    Replies: 0
    Last Post: 01-21-2002, 09:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts