Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > IBM DB2 > Getting rid of ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 8995 of 9520
Post > Topic >>

Getting rid of nuls

by blabes@[EMAIL PROTECTED] Jun 18, 2008 at 04:13 PM

Is there a way to use either the REPLACE() or TRANSLATE() function to
change ascii nul characters (chr(0)) in a given table/column to a
different character?  I've tried what I think should work, but both
functions seem to get confused when they encounter the nul in the
column.  Here's what I've tried:

CREATE TABLE test(c CHAR(10));

INSERT INTO test VALUES('abc' || x'00' || 'def');

SELECT HEX(c) from test;

SELECT REPLACE(c, x'00', 'X') from test;

SELECT TRANSLATE(colname, x'00', 'X', 'X') from test;

I could write something in sqc or perl, but I'd prefer to stay inside
DB2 (9.1.4 LUW) if possible.
 




 3 Posts in Topic:
Getting rid of nuls
blabes@[EMAIL PROTECTED]   2008-06-18 16:13:43 
Re: Getting rid of nuls
Tonkuma <tonkuma@[EMAI  2008-06-18 22:50:12 
Re: Getting rid of nuls
blabes@[EMAIL PROTECTED]   2008-06-19 13:46:01 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 21:16:34 CST 2008.