I’m working on fixing a database and have a script for correcting several tables. For example, this works fine:
mysql -u $U -p$P -D$D <<< ‘ALTER TABLE
xyz_tablenameDROPcolumnname;’
I’m not really a SQL ace so I’m not sure how to fix this one, and I’m running into a syntax error when I try this
mysql -u $U -p$P -D$D <<< ‘ALTER TABLE
drupal_url_aliasCHANGElanguagelanguageVARCHAR( 12 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ”;’
This SQL statement works fine:
ALTER TABLE
drupal_url_aliasCHANGElanguagelanguageVARCHAR( 12 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ”
The problem is that your SQL statement contains single quotes and is placed in single quotes. This confuses the shell about where one quoted string ends and a new one starts.
Try this:
I have placed the statement in double quotes. Note that double quotes are not equivalent to single quotes (e.g. variable interpolation takes place in double quotes, but not in single quotes), but in your particular case the only difference is that single quotes after
DEFAULTare kept intact.