 |
|
 |
|
Next: liuxin
|
| Author |
Message |
External

Since: Sep 16, 2004 Posts: 22
|
(Msg. 1) Posted: Wed Dec 24, 2008 10:26 pm
Post subject: Recycle Identity field value when it reaches its max Archived from groups: microsoft>public>sqlserver>programming (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: Aug 24, 2003 Posts: 1744
|
(Msg. 2) Posted: Thu Dec 25, 2008 4:25 am
Post subject: Re: Recycle Identity field value when it reaches its max [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: Jan 11, 2008 Posts: 579
|
(Msg. 3) Posted: Thu Dec 25, 2008 9:41 am
Post subject: Re: Recycle Identity field value when it reaches its max [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
How about you cycle it back to the negative limit?? I never understand why
humans feel the need to start with 1 for identities - it loses them 50% of
the possible values. Guess it is just one of those things.
Set the identity value to -2,147,483,648, which will give you a long time
before you have any possiblity of hitting values you have already got in the
table.
--
Kevin G. Boles
Indicium Resources, Inc.
SQL Server MVP
kgboles a earthlink dt net
"Ben" wrote in message
> Is it possible to recycle the identity field value back to 1 when it
> reaches
> its maximum value.
> >> Stay informed about: Recycle Identity field value when it reaches its max |
|
| Back to top |
|
 |  |
External

Since: Jan 11, 2008 Posts: 1089
|
(Msg. 4) Posted: Thu Dec 25, 2008 1:01 pm
Post subject: Re: Recycle Identity field value when it reaches its max [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
>> I never understand why humans feel the need to start with 1 for identities - it loses them 50% of the possible values. Guess it is just one of those things. <<
The mindset is simple to underestand. When you mimic a magnetic tape,
PHYSICAL records are nuimbered from 1 to n; there are no PHYSICAL
records in negative PHYSICAL positions. Once you learn RDBMS, you
stop using IDENTITY and start using keys instead. >> Stay informed about: Recycle Identity field value when it reaches its max |
|
| Back to top |
|
 |  |
External

Since: Jan 10, 2008 Posts: 213
|
(Msg. 5) Posted: Fri Dec 26, 2008 4:26 am
Post subject: Re: Recycle Identity field value when it reaches its max [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
> The mindset is simple to underestand. When you mimic a magnetic tape,
> PHYSICAL records are nuimbered from 1 to n; there are no PHYSICAL
> records in negative PHYSICAL positions. Once you learn RDBMS, you
> stop using IDENTITY and start using keys instead.
The majority use them as surrogate keys in MS SQL Server as well you know
it.
Your belief that people use them to mimic magnetic tape just highlights the
degree to which you are out of touch with the industry.
Its one thing to "learn RDBMS" but its an entirely different thing to "apply
RDBMS" the latter of which you consistently fail to do.
--ROGERSON--
"--CELKO--" wrote in message
>> I never understand why humans feel the need to start with 1 for
>> identities - it loses them 50% of the possible values. Guess it is just
>> one of those things. << >> Stay informed about: Recycle Identity field value when it reaches its max |
|
| Back to top |
|
 |  |
External

Since: Dec 21, 2008 Posts: 4
|
(Msg. 6) Posted: Fri Dec 26, 2008 11:45 am
Post subject: Re: Recycle Identity field value when it reaches its max [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
The choice of magnetic tape as an example might be a poor one - but the
concept is the same misconception that many have; and the reason why most
people set the identity seed to one
The concept of unordered, or arbitrarily ordered, sets is elusive and they
seek to provide order to chaos
There are, of course, other uses for identity; but that it is overused, and
misused, is sure.
"Tony Rogerson" wrote in message
>> The mindset is simple to underestand. When you mimic a magnetic tape,
>> PHYSICAL records are nuimbered from 1 to n; there are no PHYSICAL
>> records in negative PHYSICAL positions. Once you learn RDBMS, you
>> stop using IDENTITY and start using keys instead.
>
> The majority use them as surrogate keys in MS SQL Server as well you know
> it.
>
> Your belief that people use them to mimic magnetic tape just highlights
> the degree to which you are out of touch with the industry.
>
> Its one thing to "learn RDBMS" but its an entirely different thing to
> "apply RDBMS" the latter of which you consistently fail to do.
>
> --ROGERSON--
>
> "--CELKO--" wrote in message
>
>>> I never understand why humans feel the need to start with 1 for
>>> identities - it loses them 50% of the possible values. Guess it is just
>>> one of those things. <<
>
> >> Stay informed about: Recycle Identity field value when it reaches its max |
|
| Back to top |
|
 |  |
External

Since: Jan 11, 2008 Posts: 1089
|
(Msg. 7) Posted: Fri Dec 26, 2008 12:12 pm
Post subject: Re: Recycle Identity field value when it reaches its max [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
>> The concept of unordered, or arbitrarily ordered, sets is elusive and they seek to provide order to chaos <<
But they want a *familiar* order to the "chaos" so you see posters
here talking about"first", "last" and "next" records in a table.
That is why I say mag tape files; their ghosts lived on early disk
systems and programming languages long after the punch cards and tape
drives were scraped.
Jerry Weinberg's classic Psychology of Programming has stayed in print
for these decades because he realized that your first language gives
you a mindset and that it is hard to break. Just the formatting of
code and the length of variable names says worlds about the
programmer.
NEWID() and their ilk would avoid hot spots in generated phsycial
locators and look more like pointers. This is still not RDBMS, but it
is a more sophistificated design flaw. It says that the guy worked
with some kind of random access file system.
Since I teach SQL, I need to know the various mindsets so I can "un-
learn" my students. Maybe I shold expand that topi8c in the3 next
edition of THINKING IN SETS .. >> Stay informed about: Recycle Identity field value when it reaches its max |
|
| Back to top |
|
 |  |
External

Since: Jan 10, 2008 Posts: 640
|
(Msg. 8) Posted: Fri Dec 26, 2008 12:47 pm
Post subject: Re: Recycle Identity field value when it reaches its max [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Dec 26, 10:45 am, "m" wrote:
> The choice of magnetic tape as an example might be a poor one - but the
> concept is the same misconception that many have; and the reason why most
> people set the identity seed to one
>
> The concept of unordered, or arbitrarily ordered, sets is elusive and they
> seek to provide order to chaos
I would say that for many (maybe most) practical purposes the concept
of unordered, or arbitrarily ordered, sets is an unnecessary
complication. This is why most bright people unfamiliar with RDBMS
intuitively do not want it - they apply Occum's razor to RDBMS theory.
This includes bright young people who have never seen a computer
magnetic tape. They don't mimic magnetic tapes - they just use their
brains and common sense and reject previous generations' prejudices.
This is progress for you... >> Stay informed about: Recycle Identity field value when it reaches its max |
|
| Back to top |
|
 |  |
External

Since: Jan 10, 2008 Posts: 640
|
(Msg. 9) Posted: Fri Dec 26, 2008 1:40 pm
Post subject: Re: Recycle Identity field value when it reaches its max [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Dec 26, 3:30 pm, Hugo Kornelis
wrote:
> On Fri, 26 Dec 2008 12:12:38 -0800 (PST), --CELKO-- wrote:
> >Since I teach SQL, I need to know the various mindsets so I can "un-
> >learn" my students.
>
> If you teach SQL, then you should concentrate on LEARNING your students.
> The human brain is perfectly capable of retaining lots of information,
> there is no need to remove stuff first before you can put in something
> new.
I concur. The idea that students are so rigid that they have to
unlearn one approach before they can learn another one is just
ridiculous. You did not have to unlearn Dutch so that you can speak
English, right? >> Stay informed about: Recycle Identity field value when it reaches its max |
|
| Back to top |
|
 |  |
External

Since: Jan 11, 2008 Posts: 1089
|
(Msg. 10) Posted: Fri Dec 26, 2008 1:47 pm
Post subject: Re: Recycle Identity field value when it reaches its max [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
>> I would say that for many (maybe most) practical purposes the concept of unordered, or arbitrarily ordered, sets is an unnecessary complication. This is why most bright people unfamiliar with RDBMS intuitively do not want it - they apply Occum's razor to RDBMS theory. <<
But this is not a complication; it is a simplifcation -- a constraint
is removed. Ordering can be very elaborate -- get a librarian's guide
book for sorting book titles. This is the problem of the Familar, not
complications. Simplifcation also destroys the Familiar.
In Western culture, thanks to the alphabet, we expect an ordering.
Chinese do not expect this. An old friend of mine taught in Red China
many years ago. She got her class roster in Latin letters, but
unsorted; you simply learn the names of 150 students from a list.
>> This includes bright young people who have never seen a computer magnetic tape. They don't mimic magnetic tapes - they just use their brains and common sense and reject previous generations' prejudices. This is progress for you... <<
They are using magnetic tapes as their mindset, but they do not know
it. Magnetic tapes exist because of punch cards; punch cards are
sorted because of alphabetic order (and place-valued numbering that
allows alphabetic sorting).
They are using the previous generations' prejudices because they live
in an alphabetic cultuire. An example : nested sets versus adjacency
list model for trees. Older programmers like adjacency list models
because they look like pointer chains. Younger programmers like
nested sets because they look like HTML tags. >> Stay informed about: Recycle Identity field value when it reaches its max |
|
| Back to top |
|
 |  |
External

Since: Jan 10, 2008 Posts: 640
|
(Msg. 11) Posted: Fri Dec 26, 2008 2:29 pm
Post subject: Re: Recycle Identity field value when it reaches its max [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Dec 26, 3:47 pm, --CELKO-- wrote:
> >> I would say that for many (maybe most) practical purposes the concept of unordered, or arbitrarily ordered, sets is an unnecessary complication. This is why most bright people unfamiliar with RDBMS intuitively do not want it - they apply Occum's razor to RDBMS theory. <<
>
> But this is not a complication; it is a simplifcation -- a constraint
> is removed. Ordering can be very elaborate -- get a librarian's guide
> book for sorting book titles. This is the problem of the Familar, not
> complications. Simplifcation also destroys the Familiar.
>
> In Western culture, thanks to the alphabet, we expect an ordering.
> Chinese do not expect this. An old friend of mine taught in Red China
> many years ago. She got her class roster in Latin letters, but
> unsorted; you simply learn the names of 150 students from a list.
>
Whatever you call it - for us Westerners it requires an effort to keep
in mind that sets are not sorted. For most practical problems this
effort yields us absolutely no practical gains.
> >> This includes bright young people who have never seen a computer magnetic tape. They don't mimic magnetic tapes - they just use their brains and common sense and reject previous generations' prejudices. This is progress for you... <<
>
> They are using magnetic tapes as their mindset, but they do not know
> it. Magnetic tapes exist because of punch cards; punch cards are
> sorted because of alphabetic order (and place-valued numbering that
> allows alphabetic sorting).
>
> They are using the previous generations' prejudices because they live
> in an alphabetic cultuire. An example : nested sets versus adjacency
> list model for trees. Older programmers like adjacency list models
> because they look like pointer chains. Younger programmers like
> nested sets because they look like HTML tags.
I think you are contradicting yourself. Don't you see yourself: it is
alphabetic order not magnetic tape we are intuitively expecting. Don't
get me wrong - I think we need to change mindsets whenever it is
necessary. But the mindset change must be justified by some practical
gain, and in most cases I just don't see any need, most database
problems can be solved just fine without the concept of unordered
sets. >> Stay informed about: Recycle Identity field value when it reaches its max |
|
| Back to top |
|
 |  |
External

Since: May 30, 2004 Posts: 2060
|
(Msg. 12) Posted: Fri Dec 26, 2008 3:49 pm
Post subject: Re: Recycle Identity field value when it reaches its max [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: Jan 11, 2008 Posts: 1089
|
(Msg. 13) Posted: Fri Dec 26, 2008 4:09 pm
Post subject: Re: Recycle Identity field value when it reaches its max [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
>> Sure if you have heavy inserts then you would have less contention. But at the cost of a much higher percentage of page splits (of the "bad" kind, where half the page needs to be moved to make room for the new row). <<
Then play with the percentage of free space per data page, like we did
in the old days. . This is one reason I like perfect hashing more
and more as I get older. The CPU is fast and when the math is done, I
get to data in one probe. SQLO and perhaps IT in general gets bzack
to "it all depends..." so fast >> Stay informed about: Recycle Identity field value when it reaches its max |
|
| Back to top |
|
 |  |
|
Aaron Bertrand [SQL Serve
|
External

Since: Jan 10, 2008 Posts: 2166
|
(Msg. 14) Posted: Fri Dec 26, 2008 4:49 pm
Post subject: Re: Recycle Identity field value when it reaches its max [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: Jan 11, 2008 Posts: 1089
|
(Msg. 15) Posted: Fri Dec 26, 2008 4:55 pm
Post subject: Re: Recycle Identity field value when it reaches its max [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
>> Maybe because the Chinese didn't think Latin letters could be sorted? <<
No. They translared names directly with software in the order
enterd. They did not think about sorting at all! Hong Kong phone
operators rember 10K or more phone numbers from names They have a
contest each year ..
>> As far as I have understood it, Chinese letters are sorted by strokes <<.
There are 4 or 5 systems. It is NOT strictly strokes; it is a !@#%
mess!! In most systems, you take the base radical such as MA (horse)
then show charaters build from it (horse-fly or fly, Mother, etc. ).
I play Chinese chess and MA or "Knight" is one of the pieces.
When I was a typesetter in the 1970's , I learned that Chinese
newspapers in San Francisco classified metal type by categories -- Man
Eartth, Heaven, Animal, etc. (do you play Pai Goiw?) They set type on
roller skates -- literally >> Stay informed about: Recycle Identity field value when it reaches its max |
|
| Back to top |
|
 |  |
| Related Topics: | Determine whether a field in recordset is a Identity Field - Hi, I'm using VB6 and I want to know which Column in the recordset is the Identity Column (if any). I've a SQL Server 2000 table. It has 5 colums, the first one is the Identity Column. Now I want to recognize this column in VB6 using ADO 2.8. I used....
Next Id without Identity - I'm getting a duplicate key problem with this code. I can't use a Identity column. BEGIN TRANSACTION INSERT INTO T1 (Id1, Id2, OrderNo, Data) SELECT @Id1_p, @Id2_p, ISNULL(max(OrderNo),0) + 1, @Data FROM T1 WHERE Id1 = @Id1_p AND Id2 ...
Identity Column - Is it possible to set the indentitiy flag for a column by simply using alter table/alter column in SQL 2000 and SQL 2005.
INSERT identity - If I issue a command to insert a record with ALLOW IDENTITY INSERT will I have to reset the current IDENTITY column? Thanks. David
How to find next identity - Hi All, Is there any way to know the next identity number the server would probably assign for the identity column? I'm having a table say Student with an identity column as StudentId. How to find the next Id value the system would assign for a new.. |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|