|
#!/bin/sh
mysql -uroot -p -Didd_billing < /root/bin/upprefix.txt > /root/data/upprefix.sql
cd /root/data
ftp -ivn 193.177.243.9 <<EOT
user accou acct
cd sc/data/
put upprefix.sql
bye
EOT
--------------------------------------
upprefix.txt 里的sql是
SELECT concat("update testing set end_time=","'",DATE_FORMAT(effdate - INTERVAL 1 second,'%Y%m%d%H%i%s'),"'"," where carrier_id=","'",carrier,"'"," and prefix=","'",prefix,"'",";" into outfile '/root/data/upprefix.sql' FROM upprefix
---------------------------------------------------
生成的upprefix.sql如下:
concat("update testing set end_time=","'",DATE_FORMAT(effdate - INTERVAL 1 second,'%Y%m%d%H%i%s'),"'"," where carrier_id=","'",carrier,"'"," and prefix=","'",prefix,"'",";"
update testing set end_time='20070430235959' where carrier_id='hgc' and prefix='41';
update testing set end_time='20070430235959' where carrier_id='hgc' and prefix='411';
update testing set end_time='20070430235959' where carrier_id='hgc' and prefix='4143';
update testing set end_time='20070430235959' where carrier_id='hgc' and prefix='4144';
update testing set end_time='20070430235959' where carrier_id='hgc' and prefix='4174';
update testing set end_time='20070430235959' where carrier_id='hgc' and prefix='4176';
update testing set end_time='20070430235959' where carrier_id='hgc' and prefix='4177'; |
|