Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 bigint datatype

Author  Topic 

jgrant
Yak Posting Veteran

69 Posts

Posted - 2008-03-10 : 14:45:26
I am using bigint as a primary key. What happens when bigint reaches the maximum number that it can hold?

The Yak Village Idiot

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-03-10 : 14:48:58
You'll get an overflow error.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-03-10 : 22:18:08
What kind of value it holds? Will take a long while to fill it with identity numbers.
Go to Top of Page

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 2008-03-11 : 02:19:23
Assuming you start with 1 and go up by 1000 per second, the sun will be a burnt out cinder before you exhaust a bigint. Depending on your service level agreements, you'll probably be fine.
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2008-03-11 : 12:40:42
I think this right, I jsut did a quick hack, but.. if you run 5000 transactions per second starting at 1 you will not max out a BIGINT for about 58494241 years.
(60 sec/min * 60 min/hour * 24 hour/day * ~365 day/year) * Tx/Sec

SELECT 9223372036854775807 / (CAST((60 * 60 * 24 * 365) AS BIGINT) * CAST(5000 AS BIGINT))
Go to Top of Page

KenW
Constraint Violating Yak Guru

391 Posts

Posted - 2008-03-11 : 16:04:26
quote:
Originally posted by rmiao

What kind of value it holds? Will take a long while to fill it with identity numbers.



Come on! You have almost five thousand posts here, and you don't know enough to look this up in BOL?

I've heard of being lazy, but this is one that takes the cake.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-03-11 : 22:09:47
quote:
Originally posted by KenW

quote:
Originally posted by rmiao

What kind of value it holds? Will take a long while to fill it with identity numbers.



Come on! You have almost five thousand posts here, and you don't know enough to look this up in BOL?

I've heard of being lazy, but this is one that takes the cake.



rmiao question is not referring to the data type but the nature of the data.


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2008-03-11 : 22:22:47
quote:
Originally posted by KenW

quote:
Originally posted by rmiao

What kind of value it holds? Will take a long while to fill it with identity numbers.



Come on! You have almost five thousand posts here, and you don't know enough to look this up in BOL?

I've heard of being lazy, but this is one that takes the cake.



Imagine that..posting a non-answer criticism with a non-answer LOLOL

Hopefully the poster isn't doing more than 50 billion transactions per second..he would run out in just under 6 years. But that will be okay, because everyone will want to know how he did that...;)




Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2008-03-11 : 23:38:54
quote:
--------------------------------------------------------------------------------
Originally posted by rmiao

What kind of value it holds? Will take a long while to fill it with identity numbers.

--------------------------------------------------------------------------------



Come on! You have almost five thousand posts here, and you don't know enough to look this up in BOL?

I've heard of being lazy, but this is one that takes the cake.
-----------------------------------------------------------------------

Don't know what do you want to say.

We just assume it's for identity here, what if stores mathematic results?

Go to Top of Page
   

- Advertisement -