我无法导入到sql lite中.
我正在将表从sql Server导出到以UTF-8编码的平面文件中.然后尝试将平面文件导入sqlite db. DB是UTF-8编码的.
我正在将表从sql Server导出到以UTF-8编码的平面文件中.然后尝试将平面文件导入sqlite db. DB是UTF-8编码的.
这些行很麻烦(制表符分隔,行以CRLF结尾):
ID w posid def 1234 bracket 40 "(" and ")" spec... 1234 bracket 40 Any of the characters "(",")","[","]","{","}",and,in the area of computer languages,"<" and ">".
错误:
未转义的“性格
我试过用“双引号”替换引号,“仍然不起作用.
导入设置:选项卡分隔符
.分隔器 ” ”
.import data.txt字样
sqlite表架构:
CREATE TABLE words (ID integer NOT NULL,w TEXT NOT NULL,posid integer NOT NULL,def TEXT NOT NULL);
更新:
不知何故,在sql Server的def字段开头添加一个哈希工作:
更新单词设置def =’#’def
不知道为什么会这样.这有效,但它在该领域增加了一个不需要的角色.
事实证明,当有新行字符,引号或逗号时,导入可能会搞乱.
一种解决方案是将这些字符替换为其他字符序列或字符代码(例如char(1),char(2)…),并确保字段不包含这些序列或代码,然后再运行进口.例如,将引号替换为 –,然后导入,然后替换 – 再次使用引号.我有另一个表,其中一些文本字段有新的行字符,这个解决方案似乎工作.
before import: update [table] set comment = REPLACE(comment,CHAR(13),'-*-') update [table] set comment = REPLACE(comment,CHAR(10),'%-$-%') update [table] set comment = REPLACE(comment,'"','%-&-%') after import: update [table] set comment = REPLACE(comment,'-*-',CHAR(13)) update [table] set comment = REPLACE(comment,'%-$-%',CHAR(10)) update [table] set comment = REPLACE(comment,'%-&-%','"')