I have a SQL Server 2012 Enterprise edition linked server connection to an IBM AS400 DB2 database. I am using the IBMDASQL
provider for the connection.
I have problems with some Hungarian characters: the letter Ő
is converting to O
during the select.
In this example the name_converted
column will be OK, the Ő
letter remains Ő
.
The name column will be converted to O
.
SELECT * FROM openquery (g,
SELECT
cast(name as char(35) ccsid 870) as name_converted,
name,
FROM libr.mytable')
My question is: can I create the linked server so that all the character is using the CCSID 870?
EXEC master.dbo.sp_addlinkedserver @server = N'G', @srvproduct = N'HUN00101', @provider = N'IBMDASQL', @datasrc = N'HUN00101'
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'G', @useself=N'False',
@locallogin=NULL, @rmtuser=N'query', @rmtpassword='########'
GO
EXEC master.dbo.sp_serveroption @server = N'G', @optname = N'collation compatible',
@optvalue = N'false'
GO
EXEC master.dbo.sp_serveroption @server=N'G', @optname=N'data access', @optvalue=N'true' GO
EXEC master.dbo.sp_serveroption @server=N'G', @optname=N'dist', @optvalue=N'false' GO
EXEC master.dbo.sp_serveroption @server=N'G', @optname=N'pub', @optvalue=N'false' GO
EXEC master.dbo.sp_serveroption @server=N'G', @optname=N'rpc', @optvalue=N'false' GO
EXEC master.dbo.sp_serveroption @server=N'G', @optname=N'rpc out', @optvalue=N'false' GO
EXEC master.dbo.sp_serveroption @server=N'G', @optname=N'sub', @optvalue=N'false' GO
EXEC master.dbo.sp_serveroption @server=N'G', @optname=N'connect timeout', @optvalue=N'0' GO
EXEC master.dbo.sp_serveroption @server=N'G', @optname=N'collation name', @optvalue=null GO
EXEC master.dbo.sp_serveroption @server=N'G', @optname=N'lazy schema validation', @optvalue=N'false' GO
EXEC master.dbo.sp_serveroption @server=N'G', @optname=N'query timeout', @optvalue=N'0' GO
EXEC master.dbo.sp_serveroption @server=N'G', @optname=N'use remote collation', @optvalue=N'true' GO
EXEC master.dbo.sp_serveroption @server=N'G', @optname=N'remote proc transaction promotion', @optvalue=N'true' GO
Thanks
It looks like the data may not have been properly tagged with CCSID 870 on the IBM i system. Can you try using the "Force Translate" custom property and setting it to 870? Note: This will cause all data not properly tagged with a CCSID to be handled as CCSID 870.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.