List:General Discussion« Previous MessageNext Message »
From:Zhangzhigang Date:April 30 2012 1:52pm
Subject:回复: update query
View as plain text  
Ok, there is another approach if you are using shell script.

Step 1: You may invoke one mysql user who has not password to access the mysql database.
Step 2: Shell script:

c=0
for i in `mysql -u username -e "use database;show tables;"`
do
    if [ $c -ge 1 ]
    then
        mysql -u username  -e "use
database;update $i set client='NEW'"
    fi
    let c=$c+1
done




________________________________
 发件人: Ananda Kumar <anandkl@stripped>
收件人: Pothanaboyina Trimurthy <skd.trimurthy@stripped> 
抄送: mysql@stripped 
发送日期: 2012年4月30日, 星期一, 下午 5:26
主题: Re: update query
 
Do you just want to replace current value in client column to "NEW".
You can write a stored proc , with a cursor and loop through the cursor,
update each table.

regards
anandkl

On Mon, Apr 30, 2012 at 2:47 PM, Pothanaboyina Trimurthy <
skd.trimurthy@stripped> wrote:

> Hi all,
>      i have one database with 120 tables and each table contains one
> common column that is "client" now i want to update all the tables
> column client = "NEW". is it possible to write a single query to
> update this one.
>
> please help me.
>
> thanks in advance
>
> Thanks & Kind Regards,
> Trimurthy.p
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql
>
>
Thread
update queryPothanaboyina Trimurthy30 Apr
  • Re: update queryAnanda Kumar30 Apr
    • 回复: update queryZhangzhigang30 Apr
    • RE: update queryRick James30 Apr