Monday, February 13, 2012

About Identity Column

Dear all,
I use the identity property that makes generating unique numeric
values in my table "OrderDetail". Its primary keys include the column
"OrderHeaderNo" and the identity column. It's fine up to now. But I wonder
that if the application keep going to use for many years. Is it possible the
identity value will be overflowed? or it will restart from 1 again
automatically after the overflow. And now, i make this column type is "Int".
Anyone can help? Thanks.
Best Rdgs
Ellis
You'll get an overflow when the identity value exceeds the maximum value for
the data type If this is a possibility in your situation, consider using a
data type with a larger maximum value, such as bigint or decimal.
Hope this helps.
Dan Guzman
SQL Server MVP
"Ellis Yu" <ellis.yu@.transfield.com> wrote in message
news:ecrdWi1LFHA.904@.tk2msftngp13.phx.gbl...
> Dear all,
> I use the identity property that makes generating unique numeric
> values in my table "OrderDetail". Its primary keys include the column
> "OrderHeaderNo" and the identity column. It's fine up to now. But I wonder
> that if the application keep going to use for many years. Is it possible
> the
> identity value will be overflowed? or it will restart from 1 again
> automatically after the overflow. And now, i make this column type is
> "Int".
> Anyone can help? Thanks.
> Best Rdgs
> Ellis
>
|||Many Thanks !! Otherwise I'll be in big trouble when the system get
overflow. But now, I can I solve this problem now? and I'm using int data
type, what's its maximum value of it?
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:O7k81B2LFHA.732@.TK2MSFTNGP12.phx.gbl...
> You'll get an overflow when the identity value exceeds the maximum value
for
> the data type If this is a possibility in your situation, consider using
a[vbcol=seagreen]
> data type with a larger maximum value, such as bigint or decimal.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Ellis Yu" <ellis.yu@.transfield.com> wrote in message
> news:ecrdWi1LFHA.904@.tk2msftngp13.phx.gbl...
wonder
>
|||Hello Ellis,
from books online:
Integer (whole number) data from -2^31 (-2,147,483,648) through 2^31 - 1
(2,147,483,647). Storage size is 4 bytes. The SQL-92 synonym for int is
integer.
Regards,
Tomislav Kralj
"Ellis Yu" <ellis.yu@.transfield.com> wrote in message
news:OX2T1V2LFHA.2888@.TK2MSFTNGP12.phx.gbl...
> Many Thanks !! Otherwise I'll be in big trouble when the system get
> overflow. But now, I can I solve this problem now? and I'm using int data
> type, what's its maximum value of it?
>
> "Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
> news:O7k81B2LFHA.732@.TK2MSFTNGP12.phx.gbl...
> for
> a
> wonder
>
|||Which means that if your IDENTITY is set with the default (1,1), you can
store one row per second for the next 68 years. Just to put things in
perspective
Jacco Schalkwijk
SQL Server MVP
"Tomislav Kralj" <tomislav.kralj1@.zg.htnet.hr> wrote in message
news:eqOb%23t3LFHA.3852@.tk2msftngp13.phx.gbl...
> Hello Ellis,
> from books online:
> Integer (whole number) data from -2^31 (-2,147,483,648) through 2^31 - 1
> (2,147,483,647). Storage size is 4 bytes. The SQL-92 synonym for int is
> integer.
>
> Regards,
> Tomislav Kralj
> "Ellis Yu" <ellis.yu@.transfield.com> wrote in message
> news:OX2T1V2LFHA.2888@.TK2MSFTNGP12.phx.gbl...
>
|||Or with bigint, you can store one mullion rows per second for 1142 years
:-)
Hope this helps.
Dan Guzman
SQL Server MVP
"Jacco Schalkwijk" <jacco.please.reply@.to.newsgroups.mvps.org.invalid > wrote
in message news:e2g%23QR5LFHA.568@.TK2MSFTNGP09.phx.gbl...
> Which means that if your IDENTITY is set with the default (1,1), you can
> store one row per second for the next 68 years. Just to put things in
> perspective
> --
> Jacco Schalkwijk
> SQL Server MVP
>
> "Tomislav Kralj" <tomislav.kralj1@.zg.htnet.hr> wrote in message
> news:eqOb%23t3LFHA.3852@.tk2msftngp13.phx.gbl...
>

No comments:

Post a Comment