SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Linked Server Collation issues


Linked Server Collation issues

Author
Message
iamtig
iamtig
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1101 Visits: 238
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.



Orlando Colamatteo
Orlando Colamatteo
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14937 Visits: 14396
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search