sybase字符集设置,求大神指点

Gangnam 2016-03-07 09:43:22
window环境下安装sybase数据库,默认字符集为:

1> sp_configure 'default char'
2> go
Parameter Name Default Memory Used Config Value
Run Value Unit Type
------------------------------ ----------- ----------- ------------
----------- -------------------- ----------
default character set id 2 0 2
2 id static

(1 row affected)
(return status = 0)

即为 cp850,cp850虽然支持中文但是只支持部分中文,复杂的会乱码。
想转换成utf8,(不转cp936因为cp936不支持忽略大小写的功能,程序有这个要求)。

-----------------------------------------------------------------------------------------------------------------------

cp850 支持部分中文,支持忽略大小写。
cp936 支持中文,不支持忽略大小写。
utf8 支持中文,支持忽略大小写。

-----------------------------------------------------------------------------------------------------------------------


我转换utf8的步骤:
进入目录C:\sybase\charsets\utf8
运行命令 charset -Usa -P123456 nocase.srt utf8
运行完成后,系统就安装了utf8字符集.

使用isql命令查询
>select id,name from syscharsets
>go
utf8的id为190。

使用命令查询sortorder
select id,name from master.dbo.syscharsets where name like 'utf8%'
utf8对应的忽略大小写的sortorder为101

-----------------------------------------------------------------------------------------------------------------------


然后设置对应id号时报错,不能进行设置。

报错如下:
设置sortorderid时的报错:
1> sp_configure "default sortorder id",101
2> go
Msg 5824, Level 16, State 4:
Procedure 'sp_configure', Line 695:
Cannot reconfigure server to use sort order ID 101, because the row for its
underlying character set (ID 2) does not exist in syscharsets.
(return status = 1)
个人理解现在的字符集为Id为2,即cp850,cp850字符集下并没有 101这个utf8的sortorder的id。

-----------------------------------------------------------------------------------------------------------------------


设置字符集时的报错:
1> sp_configure "default char",190
2> go
Msg 5824, Level 16, State 4:
Procedure 'sp_configure', Line 695:
Cannot reconfigure server to use sort order ID 42, because the row for its
underlying character set (ID 190) does not exist in syscharsets.
(return status = 1)
报错原因为现在的sortorder id为42,即cp850下忽略大小的sortorder id,可是190并不与这个id对应。


这个两错误导致我怎么也不能改成utf8字符集。
目标想要支持中文的,忽略大小写的字符集设置。
请大神指教啊!!!!!

...全文
200 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
dd_1d 2016-08-25
  • 打赏
  • 举报
回复
引用 1 楼 yao_kuo 的回复:
charset -Usa -P123456 nocase.srt utf8 sp_configure "default sortorder id",50 sp_configure "default char",190 sp_configure "default sortorder id",101 最后安这个顺序依次设置,设置成功,原理未知。
哈哈哈,跟着你的做,成功了。。。虽然不知道是什么原因,如果知道的话告知小弟一声啊
Gangnam 2016-03-08
  • 打赏
  • 举报
回复
charset -Usa -P123456 nocase.srt utf8 sp_configure "default sortorder id",50 sp_configure "default char",190 sp_configure "default sortorder id",101 最后安这个顺序依次设置,设置成功,原理未知。

2,596

社区成员

发帖
与我相关
我的任务
社区描述
Sybase相关技术讨论区
社区管理员
  • Sybase社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧