?
Solved

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

Posted on 2008-01-29
2
Medium Priority
?
558 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

0
Comment
Question by:Jim Horn
2 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 2000 total points
ID: 20770436
SELECT RIGHT('00000000000000' + CAST (Floor(1234567.89*100)AS VARCHAR(100) ) ,14 )
0
 
LVL 66

Author Closing Comment

by:Jim Horn
ID: 31426065
Thanks much.  -Jim
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

588 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question