Well, you should be using scope_identity for one, not @@identity.  Will your
insert alway be a single row insert?   I am sure you will no doubt have to
update the record after insert, though you may be able to do it in one go...
I will have to investigate.


 




"This e-mail is from Reed Exhibitions (Gateway House, 28 The Quadrant,
Richmond, Surrey, TW9 1DN, United Kingdom), a division of Reed Business,
Registered in England, Number 678540.  It contains information which is
confidential and may also be privileged.  It is for the exclusive use of the
intended recipient(s).  If you are not the intended recipient(s) please note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful.  If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910.  The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions." 
Visit our website at http://www.reedexpo.com

-----Original Message-----
From: Mik Muller
To: CF-Talk
Sent: Mon Mar 19 18:08:48 2007
Subject: @@identity

For years I've been using SELECT @@IDENTITY AS ID in my code to get the
record ID for a newly inserted record. And now I'm wondering... would this,
or something similar, work inside an insert statement?

I'm working on some insert code right now and one of the fields is a notes
field that I'm storing some HTML, including (possibly) a path to an image
that would be based on the record ID, ie; /path/to/###/record/image.jpg

I know it's a bit redundant, and that I could make an image field in the
table and automate the appearance of the image through code, but I was
wondering if there was anything in the SQL insert statement that would be
aware of the impending unique ID that I could use.

Mik




--------
Michael Muller
Admin, MontagueMA.net Website
work (413) 863-0030
cell (413) 320-5336
skype: michaelBmuller
http://www.MontagueMA.net

Eschew Obfuscation






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

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

Reply via email to