Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

LINKED SERVER: COLLATION / ENCODING Problem, PLEASE HELP!

Posted on 2003-11-23
10
927 Views
Last Modified: 2007-12-19
I have a linked server to PostgreSQL on my SQL 2K Server.
While trying to retrieve data from the linked server without using any collation I get "?????" instead of data. (it's because the data stored on PostgreSQL is in Hebrew).

If I use something like this:
SELECT myfield COLLATE SQL_EBCDIC273_CP1_CS_AS as myfield FROM OPENQUERY(linked_server, ....)
then I can see returned data.

BUT if I do the same with FOR XML AUTO at the end (i.e. SELECT myfield COLLATE SQL_EBCDIC273_CP1_CS_AS as myfield FROM OPENQUERY(linked_server, ...)  FOR XML AUTO) I continue receiving "?????".

1. Is it possible to set COLLATION GLOBALLY for all returned fields by PostgreSQL?
2. How to retrieve DATA using FOR XML clause (in this specific issue with collation conflicts)

Thanks.
0
Comment
Question by:bibarius
  • 6
  • 4
10 Comments
 
LVL 9

Expert Comment

by:miron
ID: 9808129
my first turn would be to try something easy, like this

select * from
(SELECT myfield COLLATE SQL_EBCDIC273_CP1_CS_AS as myfield FROM OPENQUERY(linked_server, ...) ) as dt for xml auto

0
 

Author Comment

by:bibarius
ID: 9808175
Hi Miron!

I tried what you wrote. It looks so:
select fname from (
select fname COLLATE SQL_EBCDIC273_CP1_CS_AS as fname from openquery(secureshop, 'select fname from userdb order by clubid desc limit 10') ds) as ds
for xml auto

.. but same result.... I get "?????" after I use FOR XML AUTO...
0
 
LVL 9

Expert Comment

by:miron
ID: 9808212
well, it looks like SQL Server provides for setting up collation for a linked server this way

sp_serveroption @server = 'secureshop'
    ,@optname =  'collation name'
    , @optvalue = 'SQL_EBCDIC273_CP1_CS_AS'

I am not sure that it would help with XML AUTO though, one more to go

--cheers
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

Author Comment

by:bibarius
ID: 9808229
I'v already tried this...
It doesn't help...
0
 
LVL 9

Expert Comment

by:miron
ID: 9808353
on the other hand, could you try something like this

setup linked server collation to SQL_EBCDIC273_CP1_CS_AS

then on the local SQL Server from windows command prompt execute

bcp "select * from ( secureshop, 'select fname from userdb order by clubid desc limit 10' ) as dt for xml auto" queryout C:\test.xml -c -C 1252  -T

and then try to view the file C:\test.xml in the IE. You will need to edit xml root node if the query returns multiple rows.


--cheers
0
 
LVL 9

Expert Comment

by:miron
ID: 9808408
In that post

"
I'v already tried this...
It doesn't help...
"

did you mean it misses to help with XML or it does not help completely. Also, if none of the above helped, could you post the result of this query


select top 1  convert( binary(256), fname ) from  ( select fname COLLATE SQL_EBCDIC273_CP1_CS_AS as fname from openquery(secureshop, 'select fname from userdb order by clubid desc limit 10') ds ) as dt
0
 

Author Comment

by:bibarius
ID: 9808437
None of the above helped.

The result of your last query is:
0xF9ECE5EEE9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0
 
LVL 9

Accepted Solution

by:
miron earned 500 total points
ID: 9808942
do you have any special fonts installed for rendering Hebrew
0
 

Author Comment

by:bibarius
ID: 9808958
Hi Miron!

I just finished dealing with this problem.
Everything fixed after I rebuilt the server and set other collation.

Thank you for your help (willing to help) :-)
You earned your points :-)
0
 
LVL 9

Expert Comment

by:miron
ID: 9809018
Hi bibarius,

            thanks for being generous :)

--cheers
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question