USEGEAR

导航

把postgreSQL的表导入SQLite

万能的互联网,一查一大堆废话,几乎搞不定。现将查到的资料结合实践概况如下,对不对也不清楚,反正可以跑了。

1、把PostgreSQL的表SQL语句复制出来

CREATE TABLE "main"."HospDeptCostDetail" (
  "HDCD_ID" varchar(32) COLLATE "pg_catalog"."default" NOT NULL,
  "HDCD_TypeCode" varchar(20) COLLATE "pg_catalog"."default",
  "HDCD_TypeName" varchar(40) COLLATE "pg_catalog"."default",
  "HDCD_Date" date,
  "HD_No" varchar(32) COLLATE "pg_catalog"."default",
  "HDCD_DeptName" varchar(40) COLLATE "pg_catalog"."default",
  "HDCD_DeptType" varchar(20) COLLATE "pg_catalog"."default",
  "HDCD_Summary" varchar(40) COLLATE "pg_catalog"."default",
  "HDCD_DetailCode" varchar(32) COLLATE "pg_catalog"."default",
  "HDCD_DetailName" varchar(40) COLLATE "pg_catalog"."default",
  "HDCD_DetailAmount" numeric(10,4),
  "HDCD_DetailSum" money,
  "HDCD_Source" varchar(40) COLLATE "pg_catalog"."default",
  "HDCD_SourceNo" varchar(32) COLLATE "pg_catalog"."default",
  "HDCD_Memo" varchar(18) COLLATE "pg_catalog"."default",
  "UseField1" varchar(40) COLLATE "pg_catalog"."default",
  "UseField2" varchar(40) COLLATE "pg_catalog"."default",
  "UseField3" varchar(40) COLLATE "pg_catalog"."default",
  "UseField4" varchar(40) COLLATE "pg_catalog"."default"
)

ALTER TABLE "main"."HospDeptCostDetail" ADD CONSTRAINT "PK68" PRIMARY KEY ("HDCD_ID");

2、修改相关内容。postgresql主要是public换成sqlite的main。其他就不要动了。这样生成的表,就是你定义的。否则几乎所有字段清一色text属性。

3、执行SQL语句。

 

 4、goodluck

posted on 2021-09-28 17:22  USEGEAR  阅读(402)  评论(0编辑  收藏  举报