Solved

Convert Integer into a fix  Char column

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

Turn Insights Into Action

You’ve already invested in ITSM tools, chat applications, automation utilities, and more. Fortify these solutions with intelligent communications so you can drive business processes forward.

With xMatters, you'll never miss a beat.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
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 …
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

717 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