I dont believe he meant flag it and leave it... what would be the point of that... he meant flag it then the next time you add a record just UPDATE a field flagged as deleted...
(which is probably the only way to do what he wants easily... prepopulate 255 records and flag them all deleted to start out)

I usually set it to a normal int and PK then use MAX(pk) to add 1 to and get the new number if I want reusable numbers

your not going to be able to keep it in the ranges of 1 - 255. eventually its going to need higher numbers unless you waste a lot of time and server processing to figure out what numbers are available in that range, 1 or 2 k isnt going to kill you when you said yourself.... your never going to have more than 255 records in it anyway

  ----- Original Message -----
  From: Tom Kitta
  To: CF-Talk
  Sent: Monday, May 31, 2004 8:08 PM
  Subject: RE: creating reusable primary keys

  That would defeat the original purpose of saving space in the DB. Besides,
  integers aren't that big and space is cheap these days. Why go through the
  trouble of doing all that to save less than 1kb? Anyone remembers win2k? How
  did it happen - some space saving issue, wasn't it?
  [Tom Kitta]
  My philosophy is to make things as simple as possible (but not simpler) if
  at the same time I can get some free goodies like performance or extra free
  space than I go for it. But KISS rules most of the time, if not all of the
  time. Just my .02c.

  TK
  http://www.tomkitta.com

    -----Original Message-----
    From: Dick Applebaum [mailto:[EMAIL PROTECTED]
    Sent: Monday, May 31, 2004 8:01 PM
    To: CF-Talk
    Subject: Re: creating reusable primary keys

    Yes, don't delete the records -- just flag them as deleted (have a
    column in the db to indicate the the record is deleted)

    Dick

    On May 31, 2004, at 4:53 PM, Nick Cabell wrote:

    > I guess this is more a DB question, but I'm thinking there is some
    >  wisdom on how to create PKs in CF that I don't have.
    >
    >  I am being space conscious and have declared a PK for a table
    >  with a data type of TINYINT because I will never have more than
    >  255 records. My records don't have suitable unique values so I wanted
    > to
    >  use the IDENTITY attribute in SQL Svr to automatically create the
    >  primary keys. Trouble is that once I delete one of the records,
    >  that PK value will never be used again.
    >
    >  Is there a clever way in CF to create the PK yourself and be
    >  able to reuse the value when it is deleted.
    >
    >  Nick Cabell
    >  451 Learning Systems
    >  (650) 823-1858
    >
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to