Solved

Convert Integer into a fix  Char column

Posted on 2006-06-18
3
316 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
  • 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
I have a large data set and a SSIS package. How can I load this file in multi threading?
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.

773 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