troubleshooting Question

Format numbers in 2008

Avatar of Jeff Jones
Jeff Jones asked on
Microsoft SQL Server 2008* T-SQL
4 Comments1 Solution111 ViewsLast Modified:
Have a random numberic values that needs to be converted to 4 characters.  Depending on the number, the padding of the zero's on either the right or the left will vary.  For instance = a value of 147.8 will be converted to 1478 (decimal point is stripped out).  If the value is 0.9 the converted value needs to be 0009.  However, there could also be an instance where the value is 7.8 and the converted value would be 0780.

If this were in 2012, I think I could use the Format() function, but since that's not an option I need some help in how I can accomplish this as efficiently as possible.
Sharath S
Data Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
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 4 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