[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

0 padding

Posted on 2004-11-15
3
Medium Priority
?
4,518 Views
Last Modified: 2012-06-22
I'm sure this is a rather simple question but how exactly could I convert a number to a string with 0 padding ?

i.e.

3 becomes "003"

0
Comment
Question by:gregoryyoung
3 Comments
 
LVL 1

Accepted Solution

by:
wyckedone1 earned 500 total points
ID: 12587557
There a several ways to do it.  You can find some example queries here:

http://www.databasejournal.com/features/mssql/article.php/10894_2222111_1
0
 
LVL 50

Assisted Solution

by:Lowfatspread
Lowfatspread earned 500 total points
ID: 12587565


 Select Right("000" + convert(varchar(3),YourColumn),3)
0
 
LVL 37

Author Comment

by:gregoryyoung
ID: 12587630
Cheers.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Suggested Courses

834 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