principle

platform command starts with ".";

whiel sql command doesn't starts  with ".", but ends  with ";"

===============================================

错误现象:

=============================================

.import device_test.txt device;
Error: no such table: device;
sqlite>

原因 device后面不该有分号;

解决:命令改为    .import device_test.txt device

注意,以“.”开头

================================

sqlite> .import test.txt device
test.txt:1: expected 5 columns but found 1 - filling the rest with NULL
test.txt:2: expected 5 columns but found 1 - filling the rest with NULL
test.txt:3: expected 5 columns but found 1 - filling the rest with NULL

cause: 没有设置seperator ","

solution: input :  .separator ","

===================================

常用命令

delete from TableName;  //清空数据
update sqlite_sequence SET seq = 0 where name ='TableName';//自增长ID为0

select count(*) from device;

cd D:\sqlite_files\sqlite-tools-win32-x86-3230100

运行 sqlite3 device.db

出现sqlite>
退出命令 .quit

D:\sqlite_files\sqlite-tools-win32-x86-3230100>sqlite3.exe device.db
SQLite version 3.23.1 2018-04-10 17:39:29
Enter ".help" for usage hints.
sqlite> .tables ++++++++++++显示所有表格的表名
device
sqlite>

查看表结构
sqlite> .schema
CREATE TABLE device
(
id text,
device_no text,
device_name text,
owner text,
register_date text
);
sqlite>

sql3> select * from device;

我自己总结的sqlite 的命令行命令

导入文本数据文件时,设置分隔符为","
sql>.separator ","

sql>.import devices_20181206.txt device

注意import 前面有一个".",而且不要以;结尾

txt文件必须另存为utf8格式

sqlite数据库安装在d:\sqlite_files
运行sqlite3
查看数据表,命令,.tables

数据库文件 d:\sqlite_files\device.db

create table device
(
id text,
device_no text,
device_name text,
owner text,
register_date text
)

建立目录D:\android_projects\qrscan\app\src\main\assets
把数据库文件d:\sqlite_files\device.db 拷贝到 D:\android_projects\qrscan\app\src\main\assets
然后在as中,即android studio中出现该文件图标,右键点击,选择sql文件即可

++++++++++++++++++++++++++++++++++++++++++

问题

导入数据,import

出现提示

device_20181214.txt:683: expected 5 columns but found 1 - filling the rest with
NULL
device_20181214.txt:684: expected 5 columns but found 1 - filling the rest with
NULL
device_20181214.txt:685: expected 5 columns but found 1 - filling the rest with
NULL
device_20181214.txt:686: expected 5 columns but found 1 - filling the rest with
NULL

解决,不理它。

最新文章

  1. django开发过程中静态文件路径配置
  2. App Store
  3. svn update错误
  4. 我认为我可以去尝试做一下Maya Ue4导出插件
  5. 《SQL Server企业级平台管理实践》读书笔记——SQL Server数据库文件分配方式
  6. 苹果app审核的规则总结
  7. 压缩/解压 zip 时遇到 java.lang.IllegalArgumentException: MALFORMED
  8. C#控件命名规范
  9. HDU -2674 N!Again(小技巧)
  10. This exception may occur if matchers are combined with raw values
  11. 团队作业7——Alpha冲刺之事后诸葛亮(宣告项目失败团队解散)
  12. ftp 传输数据:命令链路连接方法是一样的,而数据链路的建立方法就完全不同
  13. 【URLOS开发入门】docker官方系统镜像——Alpine入门教程
  14. C++中static_cast和dynamic_cast强制类型转换
  15. 第二个Sprint冲刺第三天(燃尽图)
  16. jquery.form.js 让表单提交更优雅
  17. ASP.NET Web Pages:文件
  18. Opera Unite如何架设自己的网站
  19. [CodeForces850C]Arpa and a game with Mojtaba
  20. Linux_Windows7使用VMare安装Centos6.5并使用Xshell连接Centos

热门文章

  1. 写给.NET开发者的Python教程(一):引言
  2. python文件处理-将图像根据坐标切割成若干小图
  3. Java工具类——日期相关的类
  4. js事件入门(5)
  5. LeetCode54. 螺旋矩阵
  6. Python之浅谈多态和封装
  7. 你想了解的 HTTPS 都在这里
  8. Mybatis 动态insert语句
  9. 猿灯塔:关于Java面试,你应该准备这些知识点
  10. Navicat远程连接MySQL 提示1045 - Access denied for user 'root'@'223.74.158.192'(using password:YES)