Tuesday, March 27, 2012
Error pulling unicode data from DB2 Linked Server
We have been Selecting data from A DB2 AS400 via Linked Servers in SQL 7.
We began to pull data from new intstance/tables that contain some fields with foreign characters. (double byte, unicode) Some data will pull fine, then we will get an error:
Unexpected NULL value returned for column '[MYLINKEDSERVER].[DB2NAME1].[DB2NAME2].[MYTABLENAME].DESC2' from the OLE DB provider 'MSDASQL'. This column cannot be NULL.
The DBA from the other country tells me that the field is never null.
KB article Q239458 seemed related but doesn't help. We are running SP4, and will be trying on SP3 soon.
Is there any way to turn off this checking for NULL? My guess is that it interprets the unicode as a NULL incorrectly. I've tried to explicitly cast into varchar(30.)
Sometimes this fields is readable in English and it contains data that is critical when we can see it.
Thanks In Advance,
MikeyrowThe Work-Around developed was to use a pass-thru query to the DB2. I used a NULLIF function to replace any nulls, and that prevented the OLE-DB layer from erroring and failing.
Ideally we would want the DBA in the other country to fix this themselves, but sometimes time won't allow the cogs to churn enough to get the ideal solution developed.
Mike Rowland
Monday, March 12, 2012
Error of max length of string using sql DTC to import DATA
I am trying to use DTC to import about 500 records from an Excelsheet to an SQL database.
Some fields contain strings with a length of about 1700 characters.
When i'm trying to execute the DTC generated code it is giving an error and saying that the maximum string length of 255 has been reached. Althoug the column in the database is defined as nchar(1750).
Does anybody know an answer to this problem ?
Thanks in advance,
Goofythe max length of 255 is probably referring to the max length of text in a spreadsheet cell.
i know when i export to excel, all cell text gets clipped at 255 characters.|||Hi Thanks for your suggestion.
But till now no succes. I tried using .CSV as import type but still the same problem. Also if i use HTML as input type although the complete text (1700 char) is between the <DATA> and </DATA> tags.
Anybody with other suggestions ?