Search code examples
c#sqlc-treeace

How to import a csv into c-tree


I am using ctreeACE to create a local database, and I was given a csv file that contains 1000 entries of data and wanted to know if there was a way to import it without hard coding it?

Right now I am having to insert line by line with:

INSERT INTO testdata VALUES 
('1ZE83A545192635139','2018-06-19 00:00:00',etc)

Note that ctreeACE only allows single row inserts with INSERT...VALUES (Source)


Solution

  • I can't find a way to do this directly, but you could use this tool to create your insert statements.

    First input your data. You can load the csv directly, I just hardcoded two sample lines:

    enter image description here

    Next set your input options as needed. I used comma separators and ' as a quoting character in the example:

    enter image description here

    Third, set your output options. This would be a huge screenshot and is pretty self-explanatory so I'm leaving it out.

    Last, click CSV to SQL Insert, and it will generate formatted insert statements (one line per insert) for you:

    enter image description here

    Hope that helps.