Friday, March 9, 2012

Identity field max size

What is the highest value that an identity field in a table can reach? is
there a limit to the size of the interger? or is it something like a 64bit
integer field used... If it's just a standard integer field, limiting it to
32,000 numbers it could use would be bad for my app..anything like this to
worry about when using an identity column for a primary key? thanks!The max value is dependent on the datatype you select (the span of values
for all datatypes are documented in Books Online, TSQL reference,
Datatypes).
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=...ublic.sqlserver
"Brian Henry" <Fakeaddress@.reschini.com> wrote in message
news:%236EBytP7DHA.1504@.TK2MSFTNGP12.phx.gbl...
> What is the highest value that an identity field in a table can reach? is
> there a limit to the size of the interger? or is it something like a 64bit
> integer field used... If it's just a standard integer field, limiting it
to
> 32,000 numbers it could use would be bad for my app..anything like this to
> worry about when using an identity column for a primary key? thanks!
>|||In article <elqJ82P7DHA.3804@.tk2msftngp13.phx.gbl>,
tibor_please.no.email_karaszi@.hotmail.nomail.com said...
> The max value is dependent on the datatype you select (the span of values
> for all datatypes are documented in Books Online, TSQL reference,
> Datatypes).
And if you have it as an int you can always roll it over to -2.1 billion
when you hit the max as long as your app doesn't use the identity for <>
operations. You can also switch it to bigint at that point and never
worry about filling it up, but that DDL operation would probably take a
while to update the table.

No comments:

Post a Comment