Puiu Posted March 1, 2006 Posted March 1, 2006 I want to store a 13 digits number in a table in a database and i was curios what would be the best data type to do this? Varchar or Bigint ? I don't need to calculate anything with these numbers, just to store them using the lowest disk space Quote
Cags Posted March 1, 2006 Posted March 1, 2006 I don't know whether it applies to general programming, but when I was working with access databases back at 6th form (5 years ago now) we were told that if a number will never be used for calculation you should store it as a string. Quote Anybody looking for a graduate programmer (Midlands, England)?
Joe Mamma Posted March 1, 2006 Posted March 1, 2006 I want to store a 13 digits number in a table in a database and i was curios what would be the best data type to do this? Varchar or Bigint ? I don't need to calculate anything with these numbers, just to store them using the lowest disk spacediskspace is cheap compared to a hard to find bug. store them in char(13) - left pad with zeros. nothing worse that people storing SSN's in int fields. Quote Joe Mamma Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized. Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.
*Experts* Nerseus Posted March 1, 2006 *Experts* Posted March 1, 2006 For me, if I know it's a number that I'm storing, I'd rather use a bigint than varchar. I'm thinking ahead to when this is read out - if it's varchar, there's a chance someone will put the letter "a" out there. I hate writing conversion programs for older systems where everything was a varchar, even dates, and you get those weird anomalies that won't convert right. If this is a number that "looks like" a number but isn't (like an SSN), I'd definitely store as varchar. -ner Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.