-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
If you're using MSSQL, here's a non-StoredProc way to accomplish
this. This is nicer in a case where a stored proc doesn't really
make sense for a quick little query:
<CFQUERY name="Whatever" datasource="#Application.DSN#">
SET NOCOUNT ON
INSERT INTO YourTable
(Field1, Field2)
VALUES ('a','b')
SELECT TheID = @@IDENTITY
SET NOCOUNT OFF
</CFQUERY>
Now you can reference Whatever.TheID. Note that the SET NOCOUNT bit
is what makes this work.
Best regards,
Zac Bedell
========================================
Zachary S. Bedell,
Chief Technology Officer,
Adirondack Technologies, Inc.
> -----Original Message-----
> From: Nick Slay [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 25, 2000 6:30 PM
> To: [EMAIL PROTECTED]
> Subject: Re: returning autoID after insert [sql] [tip]
>
>
> I'm a bit puzzled with this one. Why would you write a
> Trigger to fire
> after an Insert statement, when you can do it in one hit using
> SELECT @@IDENTITY after the INSERT Statement all in one stored
> procedure?
>
> CREATE PROCEDURE UserFunction_Add
> @FunctionId INT = 0 OUTPUT,
>snip<
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.2 for non-commercial use <http://www.pgp.com>
Comment: Please use PGP!!!
iQA/AwUBOS2tBwraVoMWBwRBEQLkFgCg/pwBiJSZ5m30W5N2X1jWJxFuv2AAoKPx
rdofPLnYGhjhjOMi3h3mZRh7
=C3Jr
-----END PGP SIGNATURE-----
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.