troubleshooting Question

Formating the number

Avatar of jung1975
jung1975 asked on
Microsoft SQL Server 2005
12 Comments1 Solution185 ViewsLast Modified:
I have a following statement that places '0's in front of the amount make it total 27 characters

select RIGHT('00000000000000000000000' + convert(varchar, CAST((amount) AS numeric(23,3)),27) , 27)

from Table

The positive amount should look like this

00000000000000000000050.000

But if the amount is negative , I would like to palce the (-) sign to the left of the number

-0000000000000000000040.000

How can I do this?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 12 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros