[thelist] @@IDENTITY w/SQL 7 - ColdFusion query
Erik Mattheis
gozz at gozz.com
Sat Aug 11 01:48:28 CDT 2001
Thanks people ... I googled the Internet again and came up with a
solution different that what has been suggested or I'd seen before:
<cfquery datasource="dsn" name="the_query">
SET NOCOUNT ON
INSERT INTO table_name([columns])
VALUES([values])
SELECT whatever_id = @@IDENTITY
SET NOCOUNT OFF
</cfquery>
This results in #the_query.whatever_id# being the ID of the row that
was just created. I've no idea what those no count things are doing
and I don't see the syntax of SELECT [variable] = @@IDENTITY anywhere
in the SQL 7 books online; but I don't have to understand it, just so
my magic electric box does!
--
- Erik Mattheis
Who reflects too much will accomplish little.
(612) 827 3963
More information about the thelist
mailing list