Navigate
Home
ArticleWiki
Forum
Journal
Search
Newsletter
Links
Tech News
expertsrt.com
Welcome Guest.
Username:

Password:

Remember me

Large Integer Column Type
Welcome, Guest. Please login or register.
December 02, 2008, 07:44:09 AM
11304 Posts in 1248 Topics by 498 Members
Latest Member: katCheeme
Experts Round Table Network  |  Databases  |  MySQL  |  Large Integer Column Type « previous next »
Pages: [1]
Author Topic: Large Integer Column Type  (Read 915 times)
CrYpTiC_MauleR
Site Builder

Offline Offline

Posts: 489



WWW
« on: June 10, 2007, 01:39:43 AM »

Is there any way to store an integer where the the max unsigned value would be
340282366920938463463374607431768211456

bigint only goes as far as 18446744073709551615
right now I have the column set as varchar(39) is there any other way?
Logged

[x] Fight | www.crypticmauler.com
"You must be
rdivilbiss
Governing Council Member
*
Offline Offline

Posts: 414



WWW
« Reply #1 on: June 10, 2007, 07:50:20 AM »

Before I finished reading your question I thought of suggesting varchar, which is what you are using.

Now if this value is being used with PHP and it overflows the bounds of an integer value it will be converted to a float, so you could use a double in MySQL, as you xhouldn't have rounding errors with integer values, but still I'd probably just use varchar.
Logged

Rod
CrYpTiC_MauleR
Site Builder

Offline Offline

Posts: 489



WWW
« Reply #2 on: June 10, 2007, 02:04:19 PM »

I had to end up using PHP's bcmath functions to calculate the numbers otherwise it goes out of range. Doing so keeps it from becoming a float but then stuck with large number that want in database as an integer so I can do queries that use < and > etc you check ranges and stuff. AFAIK putting it as varchar doesn't allow that and if it does I think it converts the string to an integer which would be wrong value.
Logged

[x] Fight | www.crypticmauler.com
"You must be
rdivilbiss
Governing Council Member
*
Offline Offline

Posts: 414



WWW
« Reply #3 on: June 11, 2007, 02:53:01 PM »

Then double.
Logged

Rod
Pages: [1]
« previous next »
    Jump to: