台账建立和sqlite数据库的数据导入和导入问题
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
解决,不理它。
最新文章
- django开发过程中静态文件路径配置
- App Store
- svn update错误
- 我认为我可以去尝试做一下Maya Ue4导出插件
- 《SQL Server企业级平台管理实践》读书笔记——SQL Server数据库文件分配方式
- 苹果app审核的规则总结
- 压缩/解压 zip 时遇到 java.lang.IllegalArgumentException: MALFORMED
- C#控件命名规范
- HDU -2674 N!Again(小技巧)
- This exception may occur if matchers are combined with raw values
- 团队作业7——Alpha冲刺之事后诸葛亮(宣告项目失败团队解散)
- ftp 传输数据:命令链路连接方法是一样的,而数据链路的建立方法就完全不同
- 【URLOS开发入门】docker官方系统镜像——Alpine入门教程
- C++中static_cast和dynamic_cast强制类型转换
- 第二个Sprint冲刺第三天(燃尽图)
- jquery.form.js 让表单提交更优雅
- ASP.NET Web Pages:文件
- Opera Unite如何架设自己的网站
- [CodeForces850C]Arpa and a game with Mojtaba
- Linux_Windows7使用VMare安装Centos6.5并使用Xshell连接Centos
热门文章
- 写给.NET开发者的Python教程(一):引言
- python文件处理-将图像根据坐标切割成若干小图
- Java工具类——日期相关的类
- js事件入门(5)
- LeetCode54. 螺旋矩阵
- Python之浅谈多态和封装
- 你想了解的 HTTPS 都在这里
- Mybatis 动态insert语句
- 猿灯塔:关于Java面试,你应该准备这些知识点
- Navicat远程连接MySQL 提示1045 - Access denied for user 'root'@'223.74.158.192'(using password:YES)