kingbase支持不同编码的库

创建UTF8字符集的数据表

create database test_utf8 encoding ='UTF8';

\c test_utf8

create table test_utf8(id int,name varchar(10));

确认表的字符集为UTF8

\l test_utf8

--test_utf8数据表写入中文数据;

\c test_utf8

insert into test_utf8 values(1,'中国');

--查询写入数据,预期无乱码

\c test_utf8

select * from test_utf8;

--清除环境

\c test

drop database test_utf8;

创建GBK字符集的数据表

CREATE DATABASE test_gbk WITH ENCODING 'GBK' LC_COLLATE='zh_CN.GBK' LC_CTYPE='zh_CN.GBK' TEMPLATE template0;

\c test_gbk

create table test_gbk(id int,name varchar(10));

确认表的字符集为GBK

\l test_gbk

--test_gbk数据表写入中文数据;

\c test_gbk

insert into test_gbk values(1,'中国');

--查询写入数据,预期无乱码。

\c test_gbk

select * from test_gbk;

--清除环境

\c test

drop database test_gbk;

创建GB18030字符集的数据表

CREATE DATABASE test_GB18030 WITH ENCODING 'GB18030' LC_COLLATE='zh_CN.GB18030' LC_CTYPE='zh_CN.GB18030' TEMPLATE template0;

\c test_gb18030

create table test_GB18030(id int,name varchar(10));

确认表的字符集为gb18030

\l test_gb18030

--test_GB18030数据表写入中文数据;

\c test_GB18030

insert into test_GB18030 values(1,'中国');

--查询写入数据,预期无乱码。

\c test_gb18030

select * from test_GB18030;

--清除环境

\c test

drop database test_gb18030;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值