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

urgent - Formating issue

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
------------------------------ 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.