You didn't say what db server you are running but if you are running MS
SQL Server and don't mind sacrificing portability then this type of
thing works very well:
<cfquery name="MyQuery">
SET NOCOUNT ON
INSERT INTO MyTable
(Field1, Field2)
VALUES(#myField1#, #myField2#)>
SET NOCOUNT OFF
SELECT @@IDENTITY AS ID
</cfquery>
The new ID is then available as MyQuery.ID
--- Yuri Vorontsov <[EMAIL PROTECTED]> wrote:
> One more off-topic question. Does anyone know how one can retrieve
> a unique id of a row in a SQL query? I need smth like:
>
> select ???? as this_row_uid
>
> Any ideas?
> Thanks a lot!
>
> Yuri
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists