Hi Shamil, I am not an expert in SQL, but how about:
set sqlRoads {} foreach road $roads { lappend sqlRoads "'$road'" } db eval [list insert into myTable VALUES([join $sqlRoads ,])] That way, the values are properly formatted, delimited by single quotes and separated by commas. Regards, Arjen On 2011-12-07 07:57, Shamil F. Daghestani wrote:
I have variables containing lists of values I'd like to insert into a table one row at a time. For example: if I have a variable called "road" containing three items: Miller lane, Pine street, Wilson blvd. How can I insert each of the road names in separate columns in my table? Something like: db eval {insert into myTable VALUES($roads)} I understand I can split the list, save each road name in a variable, and insert them by putting them into the table with something like ... VALUES($v1,$v2,$v3) But I don't want to do that because I have over one hundred columns and don't want to clutter my code. Thanks! ________________________________ Disclaimer: This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient or have received this email in error please notify the system manager and destroy this email. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
DISCLAIMER: This message is intended exclusively for the addressee(s) and may contain confidential and privileged information. If you are not the intended recipient please notify the sender immediately and destroy this message. Unauthorized use, disclosure or copying of this message is strictly prohibited. The foundation 'Stichting Deltares', which has its seat at Delft, The Netherlands, Commercial Registration Number 41146461, is not liable in any way whatsoever for consequences and/or damages resulting from the improper, incomplete and untimely dispatch, receipt and/or content of this e-mail. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users