RE: auto increment

Author: Gary Jeurink

Posted: 2012-08-23 at 20:24:32

Does max(idno)+1 work if my view is a filter list?

Gary

-----Original Message-----

From: Lew Schwartz [mailto:lew1716@gmail.com]

Sent: Thursday, August 23, 2012 3:09 PM

To: ProFox Email List

Subject: Re: auto increment

Unless speed is of the utmost importance, I've used

select max(idno)+1 as idno from target into cursor nextkey

to get the next value.

The problem with autoincrement is that can be very time consuming to fix

after a system crash.

On Thu, Aug 23, 2012 at 1:42 PM, Paul McNett <p@ulmcnett.com> wrote:

> On 8/22/12 12:07 PM, Gary Jeurink wrote:

> > Now that I've upped from fp-6 to fp-9, I want to change a few tables

that

> > use an integer idno as a primary key to an auto increment type. The only

> > reason these tables need a primary key is so I can update their values

> > through a view. I learned that the hard way in a football data base when

> I

> > would mark 1-game as a conference game and then find that many games

were

> > also checked also. Will it require me to go through all the tables,

> views,

> > and related forms then reset the data type? I'm not good at generating

> the

> > next higher idno from a list that is filtered. In this case I keep an

> admin

> > table that contains the next game idno to use (occasionally fails).

>

> Over the years of my experience with Fox and VFP, I used all kinds of ways

> to

> generate primary keys, and in retrospect the best ever was concatenating

> the machine

> name with the output of sys(2015).

>

> In my opinion, auto-incrementing integer keys are to be avoided.

>

> I use 40-char GUID's in my Python work, but to get those in VFP you'd have

> to rely on

> an external library which could slow you down compared to VFP's sys(2015).

>

> Paul

>

>

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/DA38E0231E9547969894E87903F492D7@OwnerPC

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2012 Gary Jeurink