Should have included an example:

echo $var
"value1","value2","value3"

echo mysql -u $user -p${password} --skip-column-names -e 'ALTER TABLE
' $table' MODIFY '$kolom' SET(" '$var' ");' $database ;

mysql -u -p --skip-column-names -e ALTER TABLE
  MODIFY  SET(" "value1","value2","value3" ");

echo mysql -u $user -p${password} --skip-column-names -e 'ALTER TABLE
' $table' MODIFY '$kolom' SET(" $var ");' $database ;

mysql -u -p --skip-column-names -e ALTER TABLE
  MODIFY  SET(" $var ");

echo mysql -u $user -p${password} --skip-column-names -e 'ALTER TABLE
' $table' MODIFY '$kolom' SET( '$var' );' $database ;

mysql -u -p --skip-column-names -e ALTER TABLE
  MODIFY  SET( "value1","value2","value3" );


I believe that this is what Michael was eluding to as well...


garotconk...@yahoo.com


________________________________
 From: Garot Conklin <garotconk...@yahoo.com>
To: Michael Dykman <mdyk...@gmail.com>; Morning Star 
<morning.star.c...@gmail.com> 
Cc: "mysql@lists.mysql.com" <mysql@lists.mysql.com> 
Sent: Wednesday, October 3, 2012 3:50 PM
Subject: Re: passing shell variable to the SET data type in parentheses
 
are you trying to get the value of var encapsulated with  ' ' marks? 
Typical shell expansion while within " " will output the literal:

var=10
echo "'$var'"
'10'


Have you tried removing the single quotes?  The shell can be funny with ' and "



 
garotconk...@yahoo.com


________________________________
From: Michael Dykman <mdyk...@gmail.com>
To: Morning Star <morning.star.c...@gmail.com> 
Cc: mysql@lists.mysql.com 
Sent: Wednesday, October 3, 2012 3:41 PM
Subject: Re: passing shell variable to the SET data type in parentheses

What is the result if you echo that line instead of running it?  ie:

echo mysql -u $user -p${password} --skip-column-names -e 'ALTER TABLE
' $table' MODIFY '$kolom' SET(" '$var' ");' $database ;

I'm not clear exactly what the text is of the command you are trying to run.

- michael dykman

On Wed, Oct 3, 2012 at 9:35 AM, Morning Star
<morning.star.c...@gmail.com> wrote:
> Hi guys,
> i have a problem when trying to pass shell variable to the SET data
> type in parentheses.
> i have a variable like this:
>
> $ echo $var
> "value1","value2","value3"
>
> what i did:
> mysql -u $user -p${password} --skip-column-names -e 'ALTER TABLE
> '$table' MODIFY '$kolom' SET(" '$var' ");' $database ;
>
> the result:
> ERROR 1064 (42000) at line 1: You have an error in your SQL syntax;
> check the manual that corresponds to your MySQL server version for the
> right syntax to use near 'value1","value2","value3' at line 1
>
> what do i have to do? please help me.
>
> Greetings,
>
> Marco
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql
>



-- 
- michael dykman
- mdyk...@gmail.com

May the Source be with you.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql

Reply via email to