x

concatenation of decimal and varchar

Hello i am using IBM db2. I have 2 columns in my table :

PER_DAY (DECIMAL(10,2))

DESCP (VARCHAR)

I want to concat the two columns in my query...

For Ex: PER_DAY=0.5 DESCP='ABCDEFGHIJ'

I want them to be displayed as

0.5-ABCDEFGHIJ

I'm using IBM DB2.

more ▼

asked Jul 31, 2011 at 11:35 PM in Default

avatar image

sagar 2
111 8 8 10

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

I found it...I used concat(concat(rtrim(char(int(PER_DAY))), '.'), rtrim(right(char(PER_DAY - int(PER_DAY)), 3)))

more ▼

answered Jul 31, 2011 at 11:49 PM

avatar image

sagar 2
111 8 8 10

Well done on finding your answer, and thank you for posting it for other people having the same problem. Could you please mark the answer as 'accepted' in order that we can all see from the main page that your problem is resolved?

Aug 01, 2011 at 12:40 AM Dave_Green ♦
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x23

asked: Jul 31, 2011 at 11:35 PM

Seen: 2419 times

Last Updated: Jul 31, 2011 at 11:35 PM

Copyright 2016 Redgate Software. Privacy Policy