Solved

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

Posted on 2012-03-14
2
431 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

706 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

23 Experts available now in Live!

Get 1:1 Help Now