MySQL Forums
Forum List  »  Newbie

Re: SQL + string
Posted by: Phillip Ward
Date: April 17, 2023 07:52AM

Short Answer:

rs_MSExcel_01!abonnee  !=  "rs_MSExcel_01!abonnee"

This might work:

Strng2 = rs_MSExcel_01!abonnee
StrSQL_00 = "INSERT INTO db_00 (" & Strng1 & ") VALUES (" & Strng2 & ")"

Be warned: If the value in abonnee is not numeric, you're on the verge of creating you're very own SQL Injection Attack.
At the very least, you would have to quote the SQL literal.

StrSQL_00 = "INSERT INTO db_00 (" & Strng1 & ") VALUES ( '" & Strng2 & "' )"
                                                        ^              ^
At best, you [really] should investigate Parameterised Queries.

I'm slightly worried by that table name as well.
It hints towards your having "db_01", "db_02", "db_793", etc., all with the same structure.
The "Table-per-Thing" Model almost always breaks down as the number of Things increases and you can get just as good performance from a single table with all the same columns, plus a "Thing" identifier.

Regards, Phill W.

Options: ReplyQuote


Subject
Written By
Posted
April 10, 2023 05:36AM
Re: SQL + string
April 17, 2023 07:52AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.