• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 333
  • Last Modified:

Convert Integer into a fix Char column

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.


  • 2
1 Solution
Aneesh RetnakaranDatabase AdministratorCommented:
SELECT RIGHT('0000000'+CAST(urIntColumn as varchar),7)
JaimeJegoniaAuthor Commented:
That's right. I've been trying to settle it using Char(7) and LEFT function.

Thanks you saved me hours.
Aneesh RetnakaranDatabase AdministratorCommented:
thanks for Grade 'B'
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now