开发者

How to specify row separators when importing into an sqlite db from a csv with non-default field and row separators?

开发者 https://www.devze.com 2023-01-10 17:24 出处:网络
I have a bunch of data that i exported from mssql using bcp with custom field and row se开发者_如何学运维parators.I would like to import the data into an sqlite database..Is there an easy way to do th

I have a bunch of data that i exported from mssql using bcp with custom field and row se开发者_如何学运维parators.

I would like to import the data into an sqlite database. .

Is there an easy way to do this with .import and .separator ? .

Or do I need to use a newline as my row separator, alter the .import source, or make insert statments for each row...


Individual records should be on a new line.

Setting .separator will arrange the field separator. Do not quote, just type in your separating character after a single space.

To start the import, use .import FILE TABLE


I just tried the above solution for a text file containing records with "|" as the field separator and the file was saved as C:\temp\test.txt and here are the commands that worked:

SQLite> .separator |

SQLite> .import C:\temp\test.txt some_table

The above 2 commands loaded the data from the test.txt file to my "some_table" in my SQLite database.

IMPORT works great for small number of rows. It jammed the data for the large number of records. It worked for 2500 records but failed for 5300 records.

0

精彩评论

暂无评论...
验证码 换一张
取 消