We help IT Professionals succeed at work.

Display Currency as char(14) with leading zeros + no decimal point

Jim Horn
Jim Horn asked
on
Medium Priority
577 Views
Last Modified: 2010-04-21
Hi All

I'm converting some Access VBA to T-SQL where I take a Currency value, remove the decimal, and feed it as a char(14) with leading zeros.

Access:  Format(Round(1234567.89*100),"00000000000000") will return 00000123456789

What is the SQL equivalent of this?

TIA
Jim

Comment
Watch Question

Database Consultant
CERTIFIED EXPERT
Top Expert 2009
Commented:
SELECT RIGHT('00000000000000' + CAST (Floor(1234567.89*100)AS VARCHAR(100) ) ,14 )
Jim HornSQL Server Data Dude
CERTIFIED EXPERT
Most Valuable Expert 2013
Author of the Year 2015

Author

Commented:
Thanks much.  -Jim

Explore More ContentExplore courses, solutions, and other research materials related to this topic.