Solved

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

Posted on 2012-03-14
2
436 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 45

Accepted Solution

by:
Kent Olsen 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

752 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