Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted
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.
Anybody looking for a graduate programmer (Midlands, England)?
Posted
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

diskspace 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.

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*
Posted

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

"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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...