 |
| |
[02/04/2010]
DB2: How to find records with non-printable characters (SQLSTATE 01517)
By: Mark Jacobsen
If you run a select statement and get the following error...
"SQLSTATE 01517: A character that could not be converted was replaced with a substitute character." you can use the TRANSLATE function to strip away printable chars, and compare that to a zero length string like so...
select *
from XX.TBL
where TRANSLATE(FIELD_X,'','ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()-=+/\{}[];:.,<>? ') <> ''
FOR READ ONLY WITH UR;
===================
Mark Jacobsen: I hope you have found this article or tip helpful. If so, please consider making a donation. 100% of all proceeds will be directed to charity: water.
Contact me at MarkJacobsen.net or @MarkJacobsen
|
|
 |
Thanks for stopping by. Please be sure to visit some of my sites for your communication needs: Toll Free Virtual PBX, Real Estate Call Capture, Hosted PBX, and Virtual Fax.
All News Articles...
|
|