By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,557 Members | 1,067 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,557 IT Pros & Developers. It's quick & easy.

SQL Replace Function Problems

P: 234
I have DB2 V7 for IBM. I have a simple select statement which produces 2 columns. Column 2 is smallint. I need col2 to say Picking instead of 720 or Verify instead of 740. Both 720 and 740 can be in the same result set. This is what I have so far. Any help will be greatly appreciated.

Select col1, varchar(replace('720', '720', 'Picking'), 10) from table1
Sep 12 '07 #1
Share this Question
Share on Google+
1 Reply

P: 6
Try using a 'CASE' expression.

In your example it would go something like:

CASE col2
WHEN <value1> THEN '<description1>'
WHEN <value2> THEN '<description2>'
FROM ...

You can do a lot more with CASE, but this should answer your question.
Nov 2 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.