| Author |
Topic |
|
joemama
Posting Yak Master
113 Posts |
Posted - 2005-10-31 : 19:03:56
|
| can anyone tell me how to design a table that has an INT value that keeps the leading zeros???no if i put in0003453i get3453thanks |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2005-10-31 : 19:23:53
|
| INT is stored in a 32 bit format internally. It is only the display of the leading zeros that is suppressed.CODO ERGO SUM |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2005-10-31 : 20:28:57
|
| Display the necessary leading zeros on the front-end, or use a varchar or char column.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-01 : 23:43:10
|
| >>can anyone tell me how to design a table that has an INT value that keeps the leading zeros???As said do this in your Presentation Layer.Where do you want to show this formatted data?MadhivananFailing to plan is Planning to fail |
 |
|
|
joemama
Posting Yak Master
113 Posts |
Posted - 2005-11-02 : 14:38:58
|
I want to display the leading zeros on the web..ASP any clues would help???quote: Originally posted by madhivanan >>can anyone tell me how to design a table that has an INT value that keeps the leading zeros???As said do this in your Presentation Layer.Where do you want to show this formatted data?MadhivananFailing to plan is Planning to fail
|
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2005-11-02 : 16:14:17
|
Good lord, just give him the answer...DECLARE @x intSELECT @x = 0003453SELECT @xSELECT RIGHT(REPLICATE('0',7)+CONVERT(varchar(7),@x),7)Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2005-11-02 : 18:25:03
|
| Display the necessary leading zeros on the front-end, or use a varchar or char column.That was the correct answer. If the leading zeros are part of the value, they should be stored that way in the database.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
TomG
Starting Member
1 Post |
Posted - 2009-11-04 : 06:02:35
|
| SELECT DIGITS(column_name) AS INT FROM Table_namewill also do it....<removed spam> |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-11-04 : 06:26:24
|
'DIGITS' is not a recognized built-in function name. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2009-11-04 : 10:00:31
|
Thanks for getting back to us 4 years later with the wrong answer. I believe DIGITS is a DB2 function.CODO ERGO SUM |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2009-11-04 : 15:08:26
|
quote: Originally posted by Michael Valentine Jones Thanks for getting back to us 4 years later with the wrong answer. CODO ERGO SUM
LOL, Too funny |
 |
|
|
|