vendredi 14 novembre 2014

How to send sql command containing a variable without running a console


Vote count:

0




I use the following mysql command to rename contents in video table, path column



UPDATE video
SET path = INSERT(path, LENGTH(path) - LOCATE('/', REVERSE(path)) + 2, 0, '201410110');


But ideally i want 201410110 to be replaced with a $mask variable that will be stored in a script that i am building



mask=$(date +%s)
mysql -u videditor -pPassword1 "UPDATE master.video SET path = INSERT(path, LENGTH(path) - LOCATE('/', REVERSE(path)) + 2, 0, '$mask');"


But I getan error when I try to run the sql command. Any clue what I am missing?



asked 1 min ago

Andy

25






How to send sql command containing a variable without running a console

Aucun commentaire:

Enregistrer un commentaire