Linked Server Collation issues

  • 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.

  • 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:

    DECLARE @v-2 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

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply