Message Boards Message Boards

0
|
4162 Views
|
0 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Selective update of mySQL database column

Posted 10 years ago

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:

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

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

  SQLExecute[tradDBconn,
     "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!

POSTED BY: Phadreus W.
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract