p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

sql_language thread: Re: Primary Key in Sql Table


Message #1 by "Don DeYoung" <deyoung@m...> on Sun, 24 Dec 2000 18:19:52 -0000
I know I'm coming into this discussion very late but from the replies that
you received (that I looked at anyway, there may be others that I didn't
see) I didn't see the following.  Sorry if I'm repeating what others have
already said.

You say that if the datatype of the identity column is decimal, you will
surely reach the maximum value.  I don't think that is so.  Decimal (or
numeric) values can have from 1 to 28 places (transact-sql help says 38,
but enterprise manager will only let you do 28).  Perhaps you are confused
by the default length attribute of the data type being 9.  This is the
number of bytes that the value will take in memory, not the number of
decimal places that it can store.  In the case of a decimal with a length
of 9, the precision or size of the number it can store is 18 places.  This
is an enormous number - 999,999,999,999,999,999 - much larger than I
imagine that you will ever need, but supposing that somehow your web
banking site is more successful than any enterprise has ever been, you can
go up to 28 places - that is 9,999,999,999,999,999,999,999,999,999.  This
is probably big enough to give uniquely identify all of particles in the
universe.  Should be enough.

HTH
Don



> I am going to maintain the log  of transactions from internet banking.  I do
> expect that the record could reach that size, since the primary key won't be
> repeated.  
> 
> -----Original Message-----
> From: Ken Schaefer [mailto:ken@a...]
> Sent: Thursday, October 12, 2000 9:50 AM
> To: sql language
> Subject: [sql_language] Re: Primary Key in Sql Table
> 
> 
> uh, how many rows exactly do you want to enter into this table?!?
> 
> Identity fields are long integer (from memory), that's a *lot* of rows...
> 
> Cheers
> Ken
> 
> ----- Original Message ----- 
> From: "Irene" <Irene.ang@a...>
> To: "sql language" <sql_language@p...>
> Sent: Wednesday, October 11, 2000 12:08 PM
> Subject: [sql_language] Primary Key in Sql Table
> 
> 
> > Hi, 
> > 
> >    If I am using a certain column as the primary key of the table ( by
> > checking on the identity option in the design view of the table ) , what
> > would happen if the primary key reaches its  maximum .   I mean, if the
> > data type of the primary column is decimal, and I increment one for each
> > newly created row, for sure, it would reach its maximum range. How would
> > SQL handle this ? How should I handle this ?
> > 
> >     If a certain row is deleted, is it that the value of the primary key
> > won't be duplicated again ???
> > 
> > Thanks in advance,
> > Irene

---
You are currently subscribed to sql_language as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-sql_language-$subst('Recip.MemberIDChar')@p2p.wrox.com

  Return to Index