On Tue, Nov 6, 2012 at 1:40 PM, Colin Hardwick <[email protected] > wrote:
> Ladies & Gentlemen, > > My first post to this list, please be gentle! > > I'm trying to import tab-separated data, example here: > > 40009402 FUND NwL "NMF"NEAVB:GB;1 NQ NwL "NMF"NEAVB:GB;1 NQ > 10000003 1991-02-14 1991-02-14 > 40009403 FUND Nwl'MF"NEA VB:GB;1 Q Nwl'MF"NEA VB:GB;1 Q > 10000003 1991-02-14 > > Table: > > CREATE TABLE Asset > ( > AssetCode TEXT PRIMARY KEY NOT NULL COLLATE NOCASE, > AssetTypeCode TEXT NOT NULL COLLATE NOCASE, > Name TEXT NOT NULL COLLATE NOCASE, > ShortName TEXT COLLATE NOCASE, > CurrencyCode TEXT COLLATE NOCASE, > PerformanceTaxCountryCode TEXT COLLATE NOCASE, > StartDate DATE, > QualifiedStartDate DATE > ); > > I am not in control of the format or content, but have a command file, the > gist of which is: > > .mode tabs > .import Feeds/Asset.txt Asset > > Line 1 of the import file is fine, but line 2 is rejected as only having 7 > fields instead of 8. I've experimented with ".separator" commands to no > avail (e.g. ".separator='\t'). It appears the the shell tool is thrown by > the (clearly) mismatched single and double quotes, but since I want it to > use tabs as the separator should this be the case? > > Of course I could write some code to look for strings like this and "fix" > them, but then I won't end up with what the supplier has provided. > > Am I missing a command here? Thanks for any input. > > Mac OS-X 10.8.2, shell SQLite 3.7.12 2012-04-03 19:43:07 > 86b8481be7e76cccc92d14ce762d21bfb69504af (latest). > > Best regards, > Colin Hardwick > _______________________________________________ > sqlite-users mailing list > [email protected] > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > If you are comfortable compiling your own shell, it is just a matter of commenting out one line here: http://www.sqlite.org/cgi/src/artifact/24cd0aa74aff73ea08594629faead564c4c2a286?ln=1872to make it ignore quotes and treat *all* tabs as delimiters. -- ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

