Wally's method can be a little dangerous, as several people could hit the
same sequence simultaneously and you could end up returning the wrong id. I
prefer to do it the other way around - return the next available sequence
number, then use it in the insert.

<cfquery name="getnew"....>
SELECT    schemaname.sequencename.nextval AS newid
FROM dual
</cfquery>

<cfquery...>
INSERT INTO schemaname.tablename(IDColumn, Column2)
VALUES    (#getnew.newid#, 'mydata')
</cfquery>

-d


Deanna Schneider
Interactive Media Developer
[EMAIL PROTECTED]


______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to