SQLite Import tools

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

SQLite Import tools

Post by phaworth » Tue Aug 04, 2009 4:47 pm

I'm trying to transfer data over from an old database into an SQLite db by exporting a .csv file from the old database and importing it into the SQLite db.

Some of the data in the old db includes carriage returns and also tabs, commas, and semi-colons. These characters are all use as either column or row separators.

The data containing those characters is enclosed in quotes but all the import tools I've tried so far treat them as separators in spite of that which results in a lot of import errors.

Does anyone know of an import tool that will deal with this situation? I have a couple of workarounds in mind but would be easiest if I could find an import tool.

Thanks,
Pete

Joe F.
Posts: 17
Joined: Thu Jul 16, 2009 11:37 pm

Post by Joe F. » Wed Aug 05, 2009 4:15 am

I would just use a text editor to convert the tabs to spaces and the returns to characters. Then you'd be able to save as a tab-delimited file which would leave all your commas and semi-colons intact.

espais
Posts: 14
Joined: Thu Jun 22, 2006 12:16 am

Post by espais » Wed Aug 05, 2009 11:11 am


phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Post by phaworth » Wed Aug 05, 2009 5:21 pm

Thanks Joe and Josep, I'll try both things.

In fact, I have already tried replacing the offending characters with special symbols and importing into the database but have now run into another problem. I replaced the returns with "~CR" and now I would like to replace the "~CR" with returns in the database. I'm using a statement in the form:

UPDATE table SET field=replace(field,"~CR",??) WHERE field LIKE "%~CR%"

... but I can't figure out what to put in where the "??" is to indicate a return. The db I came form recognised \r\n as carriage return/line feed but using that with SQLite just results in "~CR" being replaced with "\r\n".

Any ideas?

Thanks,
Pete

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Problem solved

Post by phaworth » Wed Aug 05, 2009 6:24 pm

The Firefox plugin processes carriage returns correctly so problem solved. Thanks for all the input.
Pete

Joe F.
Posts: 17
Joined: Thu Jul 16, 2009 11:37 pm

Post by Joe F. » Thu Aug 06, 2009 4:16 am

So what do they have to be?
I was going to suggest "ln".

Post Reply