Sometimes you need to fiddle with the "NOCOUNT" setting to make it work
reliably.  It depends on how the SQL server is configured.

SET NOCOUNT ON

   Insert into table (cols) values (values)
   select @@IDENTITY as maxid

SET NOCOUNT OFF

This is especially true if you are updating more than 1 statement inside the
SQL block.

-mk

-----Original Message-----
From: Aaron Rouse [mailto:[EMAIL PROTECTED]
Sent: Monday, July 11, 2005 12:07 PM
To: CF-Talk
Subject: Re: retrieve ID from db insert


I always just use triggers for when inserting, but it seemed like the worry
here was to know the ID after the insert to I'd guess display to the user.
How would a trigger help for that need?

On 7/11/05, Eddie Awad <[EMAIL PROTECTED]> wrote:
>
>
> Of course, you could also just create a "when-insert" trigger on the
> table to automatically populate the id column so you do not have to
> worry about it in your "insert" statements.
> --
> Eddie Awad.
> http://awads.net/
>
>




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:211558
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to