Using a UUID works fine if your database is only used by your CF
application.  However, if you have, or *ever will have*, other applications
updating the data, you should use an identity column.  Unless you can
foresee the future, using the Identity column is the wisest choice.

I have written several small, boring applications that were planned to be
used once and forgotten that have turned into enterprise-wide applications
that need to be updated using other tools.

Chris Evans
[EMAIL PROTECTED]
http://www.fuseware.com



-----Original Message-----
From: Nick Slay [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 12, 2000 6:39 PM
To: [EMAIL PROTECTED]
Subject: RE: SQL Max record ID ?


Although you can use this approach, the quickest method is to use a stored
procedure to add the record, an Identity column for the key (in SQL Server
at least) and return that in the same stored procedure.  SQL Server 6.5 was
meant to have an occasional problem with Identity columns, however I had a
scheduled task running every night to check the Identity columns, and so
never experienced any problems on a very high-traffic site.

There was a problem using UUID's as key's that Ben Forta explained when I
asked him the question of UUID vs Identity.   I don't remember what the
exact problem was, but one of the things that Ben stresses in his Tips and
Tricks seminars is to use the database as much as possible.



At 15:52 12/05/00 -0400, you wrote:

>Although technically correct, this approach (using Max ID) is not
>recommended for large sites.
>
>A more appropriate approach would be to use the CreateUUID() function to
>calculate an ID value (to be stored in a variable), which result id an
>ID value which would be known "by the page" and eliminate the need for
>the SELECT MAX( ID) FROM... statement entirely.
>
>While the UUID value would consume a lot more disk space then the
>auto-increment integer, as the saying goes... disk space is cheap.  This
>would significant improve the performance of the server, and therefore
>the site.
>
>
>Sean
>  -----Original Message-----
>From:   Duane Boudreau [mailto:[EMAIL PROTECTED]]
>Sent:   Friday, May 12, 2000 3:41 PM
>To:     [EMAIL PROTECTED]
>Cc:     [EMAIL PROTECTED]
>Subject:        RE: SQL Max record ID ?
>
>Try this Nelson:
>
><cftransaction>
><cfquery ....>
>         insert into myTable1 ( ..... )
>         values ( ..... )
></cfquery>
><cfquery ....>
>         SELECT MAX(SomeID) AS NewSomeID
>         FROM myTable2
></cfquery>
></cftransaction>
>
>Using cftransaction insures that you get the newest SomeID inserted.
>
>Duane Boudreau,
>Project/Beta Manager, eMPower
>Director, Web Technologies
>Ektron, Inc.
>http://www.ektron.com
>5 Northern Blvd, Suite 6
>Amherst, NH 03031
>Tel: 603-594-0249
>Fax: 603-594-0258
>
>
>
> >From: Nelson Sauve <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: cf-talk <[EMAIL PROTECTED]>
> >Subject: SQL Max record ID ?
> >Date: Mon, 08 May 2000 11:28:50 -0700
> >
> >Hello,
> >
> >I have two tables Table #1 has an automatic increment field (someID).
> >
> >When I add a new record to Table #1 I want to take that someID field
> >just created and use it in Table2 (separate templates) when I create a
> >record for Table #2. That is I want the maximum value for someID in the
> >table.
> >
> >Can anyone help ?
> >
> >Thanks,
> >Nelson
> >
> >
> >-----------------------------------------------------------------------
>----
>---
> >Archives: http://www.eGroups.com/list/cf-talk
> >To Unsubscribe visit
> >http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
>or
> >send a message to [EMAIL PROTECTED] with 'unsubscribe'
>in
> >the body.
>
>________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
>------------------------------------------------------------------------
>----
>--
>Archives: http://www.eGroups.com/list/cf-talk
>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
>or
>send a message to [EMAIL PROTECTED] with 'unsubscribe'
>in
>the body.
>
>------------------------------------------------------------------------
>------
>Archives: http://www.eGroups.com/list/cf-talk
>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
>or send a message to [EMAIL PROTECTED] with
>'unsubscribe' in the body.
>---------------------------------------------------------------------------
---
>Archives: http://www.eGroups.com/list/cf-talk
>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.

----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.


------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to