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

decimal to char problems

P: n/a
Hello, I'm trying to cast a decimal colunm to char, but I'm getting bad
results like:
00000106.83
00000025.71
00000203.88
00000136.70
00000031.68
00000049.17

I need to get the result without the "zeros" at left.

The intention is generate a string result inside a stored procedure
like:

"Your sales are 106.83"
Thanks

Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
-------------------- Commands Entered --------------------
SELECT CHAR(sales) FROM TestA;
------------------------------------------------------------------------------

1
------------
00000106.83
00000025.71
00000203.88
00000136.70
00000031.68
00000049.17

6 record(s) selected.
-------------------- Commands Entered --------------------
SELECT TRANSLATE(LTRIM(TRANSLATE(RTRIM(CHAR(sales)),' ','0')),'0',' ')
FROM TestA;
------------------------------------------------------------------------------

1
------------
106.83
25.71
203.88
136.70
31.68
49.17

6 record(s) selected.

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.