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 2008 Forums
 SQL Server Administration (2008)
 INT datatype

Author  Topic 

rohitmathur11
Yak Posting Veteran

77 Posts

Posted - 2010-01-23 : 07:52:14
Hi,
In our production database for table primary key is identity column
.The datatype of this identity coulmn is INT..

what i m thinking ..there is a limit of int datatype ..that to be grow up to a centain number...

so daily we are inserting data in to tables ...pk is growing ..

what to do ..if pk column will be reached to maximum number of int
datatype can handle ..?

is there any way to solve this ...

Kristen
Test

22859 Posts

Posted - 2010-01-23 : 08:35:02
INT will give you 2,147,483,647 rows (double that if you use negative numbers too).

Is that not enough for your App?

If not then change the datatype to BIGINT - 9,223,372,036,854,775,807 rows (double if include negatives)

... and if that's not enough use DECIMAL(38, 0)
Go to Top of Page

rohitmathur11
Yak Posting Veteran

77 Posts

Posted - 2010-01-27 : 06:38:14
Hi,

Thanks a lot for giving this information ..

INT is enough for application ..

but is there dataype BIGINT available in to sql server 2005..?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-01-27 : 06:51:03
Yes.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-01-27 : 07:20:11
"so daily we are inserting data in to tables ...pk is growing .."

How many inserts? How long will 2 billion inserts last you? I would not use BIGINT unless you are going to be hitting the limit in less than 4 years (1,470,879 inserts per day, 7 days a week, 365 days a year )

If your insert rate is close to that then start the Identity at maximum negative number - then you can insert 2,941,758 rows per day ...
Go to Top of Page
   

- Advertisement -