1

I'm running SQL queries against DB2 database using IBM Data Studio. For CHAR columns (72 in length) that contain special characters within the text such as an apostrophe, the result for that record column is NULL.

When I connect to the same DB2 database using SAS or MS Access, I get the results of the column but the special character is replaced with a black diamond/white question mark.

I'm assuming that there is some sort of encoding or driver that I need to change in IBM Data Studio but I cannot figure out what it is. Any suggestions?

Robin M
  • 43
  • 3
  • 1
    Try this. select CAST( myColumn AS CHAR(72) CCSID 37 ) from mylib.mytable – danny117 Mar 30 '18 at 17:48
  • Or try this select cast(mycolumn as varchar(72)) from mylib.mytable – danny117 Mar 30 '18 at 17:48
  • Thanks. The CAST to CCSID 37 resulted in error expecting ASCII instead of 37. But then that failed. I tried CAST to NCHAR and that worked. Not sure what has changed recently as I've never had to CAST this column before. – Robin M Apr 02 '18 at 13:59
  • great news for Monday. Yes something definitely changed awesome you worked through it. – danny117 Apr 02 '18 at 14:49

1 Answers1

0

With SAS encoding might be latin, which cannot successfully convert unicode character to latin, For IBM data studio. check below link how similar problem was fixed.

http://db2commerce.com/2013/03/27/the-basics-of-code-pages-in-db2/

Kiran
  • 3,255
  • 3
  • 14
  • 21