sybase proxy database univarchar为空问题

问题描述:

使用sybase proxy database,在local server上使用insert into ... select ... 向proxy database中copy数据时,univarchar字段为null,其他字段正常。

测试环境及步骤:

 

Descriptions

Server

LOCALSVR, REMOTESVR

OS

SunOS 5.10 Generic_144489-14 i86pc i386 i86pc

ASE Version

ASE15.5 EBF 19901 SMP ESD#5.1

Default Character Set

ISO 8859-1 (Latin-1)

Database

REMOTESVR..testdb, LOCALSVR..proxy_testdb, LOCALSVR..local_testdb

User

sa

 1.       Create remote database onREMOTESVR

Create Database testdb on data1 = 10 log onlog1 = 10

go

EXEC sp_dboption testdb ,"abort tranon log full",true

go

EXEC sp_dboption testdb ,"selectinto/bulkcopy/pllsort",true

go

EXEC sp_dboption testdb ,"trunc log onchkpt",true

go

use testdb

go

CHECKPOINT

Go

 

2.       Create table in remotedatabase on REMOTESVR

CREATE TABLE  tb1                                               

 (                                                                     

 binary_col               binary(8)                    NOT NULL,       

 univarchar_col           univarchar(10)                  NULL

 )

 

3.       Create proxy database onLOCALSVR

create database proxy_testdb on data1=10log on log1=10

with default_location="REMOTESVR.testdb.dbo."

for proxy_update

go

EXEC sp_dboption proxy_testdb,"selectinto/bulkcopy/pllsort",true

go

use proxy_testdb

go

CHECKPOINT

Go

 

4.       Create local database on LOCALSVR

Create Database local_testdb on data1 = 10log on log1 = 10

go

EXEC sp_dboption local_testdb ,"aborttran on log full",true

go

EXEC sp_dboption local_testdb ,"selectinto/bulkcopy/pllsort",true

go

EXEC sp_dboption local_testdb ,"trunclog on chkpt",true

go

use local_testdb

go

CHECKPOINT

Go

 

5.       Create local table tb1 inlocal_testdb on LOCALSVR

CREATE TABLE tb1                                                

 (                                                                     

 binary_col               binary(8)                    NOTNULL,       

 univarchar_col           univarchar(10)                  NULL

 )

 

6.       Insert data toLOCALSVR..local_testdb..tb1

Insert into tb1 (binary_col,univarchar_col)values (0x00001900004f7026,'23735')

Go

Select * from local_testdb..tb1

go

binary_col                           univarchar_col

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

 0x00001900004f7026      0x32003300370033003500

 

7.       Import data toproxy_testdb..tb1 from local_testdb..tb1 on LOCALSVR

insert proxy_testdb..tb1(binary_col,univarchar_col) select binary_col,univarchar_col fromlocal_testdb..tb1

go

 

8.       Result

select * from proxy_testdb..tb1

go



解决方案:

最后找到原因了,是因为两个server的"enable unicode normalization"参数不一致导致的....

local server启用了normalization, remote server禁用了,所以转换时univarchar变成了null. 这个参数一旦禁用就不能启用了。。。 最后通过程序避开了这个问题,没禁用local server端的这个参数。

参数说明: http://infocenter.sybase.com/help/index.jsp

"
Activates Unilib character normalization. The normalization process modifies the data so there is only a single representation in the database for a given sequence of abstract characters. Often, characters followed by combined diacritics are replaced by precombined forms.

Set enable unicode normalization to 1 to use the built-in process that enforces normalization on all incoming Unicode data. If this parameter is disabled (set to 0), the normalization step is bypassed and the client code is responsible for normalization rather than the server. If normalization is disabled, performance is improved—but only if all clients present Unicode data to the server using the same representation.

Note: Once disabled, normalization cannot be turned on again. This one-way change prevents non-normalized data from entering the data base.
"

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值