Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Linked Server Collation issues Expand / Collapse
Author
Message
Posted Tuesday, December 4, 2012 1:47 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, July 17, 2014 6:35 AM
Points: 1,066, Visits: 232
Running SQL2005 sp4 and I have linked server to DB2400 UDB for iSeries using IBMDASQL provider. I use openquery method to retrieve data using a view in DB2. I am running into an issue which I believe is related to collation . I return a title, "Let?s Look Series PK 1 Fall"
When I look in the source database, it is really "Let’s Look Series PK 1 Fall"
so it is turning the ' to a ?.

Anybody have any ideas.



Post #1392685
Posted Wednesday, December 5, 2012 11:49 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 11:45 PM
Points: 7,094, Visits: 12,582
It is likely related to collation. For ANSI data types (VARCHAR, CHAR and TEXT) SQL Server will replace any characters in the data not present in the codepage (per the the collation) with a question mark. For Unicode data types (NVARCHAR, NCHAR and NTEXT) while a collation is applied for sorting and comparison purposes the collation does not impose any character restrictions and therefore no replacements to question marks will occur.

Example return a Unicode COMBINING GREEK KORONIS whicih looks like a single-quote as a varchar yields a question-mark but shows us the actual character as nvarchar:

[code="sql"]DECLARE @v INT = 835
SELECT CAST(NCHAR(@v) AS VARCHAR(10)),
CAST(NCHAR(@v) AS NVARCHAR(10))code]

What is the data type of the title column on DB2? Is it stored as some type of Unicode? What is the data type of the column you're bringing the result into? Or are you just selecting the data using SSMS and are seeing the question mark in the results pane? If you're storing it in a table try changing the data type of the column in which you're storing the data to one of the Unicode types and the question mark issue should disappear. If you are seeing the question mark in the SSMS results pane then it could be that the Linked Server provider is getting involved and causing the issue.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1393334
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse