台账建立和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
解决,不理它。
台账建立和sqlite数据库的数据导入和导入问题的更多相关文章
- 使用嵌入式关系型SQLite数据库存储数据
除了可以使用文件或SharedPreferences存储数据,还可以选择使用SQLite数据库存储数据. 在Android平台上,集成了一个嵌入式关系型数据库—SQLite, 1.SQLite3支持 ...
- Android中数据存储(三)——SQLite数据库存储数据
当一个应用程序在Android中安装后,我们在使用应用的过程中会产生很多的数据,应用都有自己的数据,那么我们应该如何存储数据呢? 数据存储方式 Android 的数据存储有5种方式: 1. Share ...
- 使用Sqlite数据库存储数据
1.Sql基本命令 1.1.创建表 表是有行和列组成的,列称为字段,行称为记录. 使用CREATE命令来创建表: 1 CREATE TABLE tab_student (studentId INTEG ...
- QT 创建本地数据库(SQLite数据库)存储数据
注意:QT自带SQLITE数据库,不需要再安装 1.创建一个包含创建.查询.修改和删除数据库的数据库类(DataBase) DataBase.h头文件 #pragma once #include &l ...
- Android平台使用SQLite数据库存储数据
创建一个DataBaseHelper的类,这个类是继承SQLiteOpenHelper类的,这个类中包含创建数据库.打开数据库.创建表.添加数据和查询数据的方法.代码如下: package com.e ...
- Oracle数据库采用数据泵方式导入导出数据
特别说明:Oralce的数据泵导入导出技术只能用在数据库服务器上,在只有客户端的机器上是无法使用数据泵技术的. 1.创建备份文件目录 mkdir d:\dmp 2.在Oralce中注册该目录,将目录 ...
- Android下用Sqlite数据库存储数据
第一步: 写个类 ,继承 SQLiteOpenHelper public class MyDatabaseOpenHelper extends SQLiteOpenHelper { } 第二步: ...
- Sqlite数据库添加数据以及查询数据方法
只是两个添加查询方法而已,怕时间长不用忘了
- mongodb远程数据库的连接以及备份导入导出数据
环境win10; 运行cmd cd到目录mongodb的bin目录: 连接远程mongodb: 连接命令:mongo -u username -p pwd host:post/database(数据库 ...
随机推荐
- 计算机网络之tcp四次挥手
TCP的四次挥手(Four-Way Wavehand)1.前言对于"三次握手"我们耳熟能详,因为其相对的简单.但是,我们却不常听见“四次挥手”,就算听过也未必能详细地说明白它的具体 ...
- zabbix4.4安装
本安装操作系统为centos7.5. 安装前准备: 1.1 安装依赖包: yum -y install wget net-snmp-devel OpenIPMI-devel httpd openssl ...
- Spring Boot Web应用开发 CORS 跨域请求支持
一.Web开发经常会遇到跨域问题,解决方案有:jsonp,iframe,CORS等等 CORS与JSONP相比 1. JSONP只能实现GET请求,而CORS支持所有类型的HTTP请求. 2. 使用C ...
- Write a program to copy its input to its output, replacing each tab by \t, each backspace by \b, and each backslash by \\. This makes tabs and backspa
#include <stdio.h> #define DBS '\\' void main() { int c; while((c=getchar())!=EOF) { if(c=='\t ...
- day01微信小程序
一.基本概要 1.一个程序接口,可以集成很多功能,也就是在程序上再次开发 腾讯:微信+小程序 阿里:支付宝 +小程序 小程序的使用量很多 2.为什么要微信小程序? 1.微信用户群体大 2.容易推广, ...
- 一天学习一点之express demo
接着上一篇,安装了nodejs之后,再安装express,顺序执行以下命令 1.npm -g install express; 2.npm -g express-generator; 3.使用exp ...
- 洛谷 P2607 [ZJOI2008]骑士 树形DP
题目描述 Z国的骑士团是一个很有势力的组织,帮会中汇聚了来自各地的精英.他们劫富济贫,惩恶扬善,受到社会各 界的赞扬.最近发生了一件可怕的事情,邪恶的Y国发动了一场针对Z国的侵略战争.战火绵延五百里, ...
- 【js】栈方法和队列方法
栈方法:后进先出,推入(push)和弹出(pop):push("**")返回数组长度,pop()返回弹出的项. var colors = new Array(); // 创建一个数 ...
- 【初学】Spring源码笔记之零:阅读源码
笔记要求 了解Java语言 了解Spring Framework的基础 会使用Maven 关于本笔记 起因 本职数据分析,为公司内部人员开发数据处理系统,使用了Python/Django+Bootst ...
- JavaScript学习 Ⅰ
一. JavaScript的使用 <script>标签 在HTML中,JavaScript代码必须位于<script>与</script>标签之间. 实例: < ...