0

I have a tab-delimited file which I'm attempting to load into a table. The table has already been created and structured appropriately, the challenge is that SQLite3 is combining the last value on one row with the first value on the next row.

So for a file where the last line was SomeText, and the next line begins with 12345, the value imported is SomeText12345

Right now I'm using the following command:

.separator "\t";

.import MyFile.tsv MyTable

Any ideas how I can get the data to load while recognizing the end-of-line?

  • Which OS is your database on? And which OS did you create `MyFile.tsv` on? – Amadan Sep 03 '18 at 22:52
  • 1
    Sounds like you copied the file from an OS with a different newline convention. If you copy from Windows to Linux, use `dos2unix` to fix it. – Barmar Sep 03 '18 at 23:16
  • I saved the file as a tab delimited file from Excel. Then I tried to load it into Sqlite3 in the same machine. – Meister1867 Sep 05 '18 at 01:27

1 Answers1

0

I noticed the same problem. I've always suspected it had to do with the last value in a tab-separated file being a TEXT type. A little stack-sniffing turned up this post wherein the second answer says:

There is actually a dedicated mode for importing tab separated files:

sqlite> .mode tabs
sqlite> .import MyFile.tsv MyTable
DinoCoderSaurus
  • 6,110
  • 2
  • 10
  • 15