Message Boards Message Boards


Selective update of mySQL database column

Posted 7 years ago
0 Replies
0 Total Likes

I would like to update several entries in a mySQL database which I use in combination with Mathematica. But the following code scenarios does not work:

i) using SQLUpdate:

 SQLUpdate[tradDBconn, "database_table",
   "column2update", {1}, 
   SQLColumn["selection_column"], # ] &,

The column "column2update" is defined as datatype "Boolean". I would like to insert a "1" (= true) into certain entries. "selectioncolumn" contains unique data (in that case stock symbols). I would like to us the "listwithselectionvalues" to identify the entries where I change "column2update" to "1".

ii) using SQLExecute

     "UPDATE database_table SET column2update = 1 WHERE FIND_IN_SET(selection_column, list_with_selection_values)"]

This function works, if I use a sth. like ('^BTS,^CSO') instead of a listwithselection_values. The Problem is, I do not know how to create a list in such a format within Matahematica. The usual Mathematica lists (e.g. {"...",",,,"}) do not work in the sql statement.

Does anyone can give me a hint? All database connections are ok. Thanks!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract