467,882 Members | 1,212 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,882 developers. It's quick & easy.

urgent - Formating issue

vp
Hi,

I have field QTY(Decimal 13,3) on the table and it might be +ve or -ve,
example below

QTY
----------
12.900
-12.900

I will have to make it to 10digits, which inclues decimal and NEGATIVE
sign
QTY
------
-0000012.9
00000012.9

Urgent advice needed

Feb 22 '06 #1
  • viewed: 1036
Share:
1 Reply
------------------------------ Commands Entered
------------------------------
SELECT qty AS Qty_13
, SUBSTR(INSERT(CHAR(DEC(qty,9,1)),2,1-INT(SIGN(1+SIGN(qty))),'')
,1,10) AS Qty_10
FROM (SELECT CAST(src AS DEC(13,3))
FROM (VALUES 12.900, -12.900, 10000000.000, 0.000,
12345678.999, -2345678.999) Q(src)
) R (qty);
------------------------------------------------------------------------------

QTY_13 QTY_10
--------------- ----------
12.900 00000012.9
-12.900 -0000012.9
10000000.000 10000000.0
0.000 00000000.0
12345678.999 12345678.9
-2345678.999 -2345678.9

6 record(s) selected.

Feb 23 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jim Mitchell | last post: by
reply views Thread by rodrigo guerra | last post: by
16 posts views Thread by | last post: by
13 posts views Thread by Niyazi | last post: by
17 posts views Thread by Saps | last post: by
9 posts views Thread by =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.