Solved

Convert Integer into a fix  Char column

Posted on 2006-06-18
3
318 Views
Last Modified: 2010-03-19
Dear Experts,

How can I convert an Integer Column into a fix Char Column like as follows:

Integer Column                         Char (7) Column
7    -----                                   0000007
8                                             0000008
9                                             0000009
10                                           0000010
100                                         0000100
1000                                       0001000

Any lead will be greatly apprciated.

Thanks.


0
Comment
Question by:JaimeJegonia
[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
3 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 300 total points
ID: 16931535
SELECT RIGHT('0000000'+CAST(urIntColumn as varchar),7)
0
 

Author Comment

by:JaimeJegonia
ID: 16931581
That's right. I've been trying to settle it using Char(7) and LEFT function.

Thanks you saved me hours.
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 16931590
thanks for Grade 'B'
0

Featured Post

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

726 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