Return to Snippet

Revision: 5431
at March 8, 2008 19:29 by gtalmes


Initial Code
INSERT INTO users (firstName, lastName, email )
VALUES ( '#FORM.LastName#', '#FORM.LastName#', '#FORM.email#' );

select thisID = @@identity

----------------------------------------------------------------------

The primary key is then referenced as Q_QueryName.thisID

"thisID" can be renamed to whatever you like

I use this code in ColdFusion, I assume it works in any language that supports SQL querying.

Initial URL


Initial Description


Initial Title
Get Primary Key ID after an INSERT

Initial Tags


Initial Language
SQL