While it probably won't happen often, depending on load, even the Now()
logic can result in two records with the same value if they come in at the
same time. And cftransaction will only work if you go all the way to
"serializable" for isolation level, which essentially single-threads access
and, again depending on how often the query is run, can be a performance
issue.

If this query isn't hit a lot by multiple threads none of this may be an
issue, but it is definitely something that must be kept in mind.

On Tue, Aug 19, 2008 at 11:26 AM, RobG <[EMAIL PROTECTED]> wrote:

> James Holmes wrote:
> > You can generally avoid the problem with a cftransaction tag if you're
> > doing the MAX(id) thing, but the other solutions are better
> > (especially the new CF8 goodies which, for example, are a life saver
> > for Oracle).
>
> I've tried using the result.identitycol trick with CF8 and MSSQL and for
> me, it doesn't work.  I just get an error.
>
> So what I've stuck to is this...
>
> Before the first insert, I do <cfset now = Now()>
>
> Then in the insert, for my date_added value, I use #now#.
>
> Then after that, when I do my select MAX(id), I also add where
> date_added = '#now#'
>
> AND I also wrap the whole thing in a cftransaction...
>
> Rob
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311263
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to