Solved

How do I Zero Fill a Result when I have a REPLACE Function in the Query

Posted on 2012-03-14
2
433 Views
Last Modified: 2012-06-21
So, this is the last part of my Query where It pulls up the Amount the Check is for, removes the Decimal, but I need it to be Zero Filled to the Left up to 10 Digits.

This is the Part of the Query I have so far.
REPLACE (CAST(checknet AS VARCHAR(20)), '.',  '')

When the Result comes back, it will come back as follows:

0001234567890010000029974201202281833329

The very last part of that you will see 1833329 That is the check amount of $18,333.29

Because that is only 7 Digits, I need 3 Zero's to fill to the Right.

Thanks again for all of your guy's help!
0
Comment
Question by:Rmumpower00
2 Comments
 
LVL 45

Accepted Solution

by:
Kdo earned 500 total points
ID: 37721372
Howdy....

Use exactly the same technique that you used for the check number


  RIGHT ('0000000' + REPLACE (CAST(checknet AS VARCHAR(20)), '.',  ''), 7)


Good Luck,
Kent
0
 

Author Closing Comment

by:Rmumpower00
ID: 37721403
Kent,
You are the man!  Thank you
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now