Did you tired using a trigger to return the inserted id?.. -----Mensaje original----- De: Dan O'Keefe [mailto:[EMAIL PROTECTED] Enviado el: Wednesday, August 17, 2005 10:37 AM Para: CF-Talk Asunto: Re: @@Identity returns excessive records
I am not using SET NOCOUNT ON/OFF but using it did not make a difference. Using SCOPE_IDENTITY() ensures your ID is at least in the same scope, but I get the same results. Dan On 8/17/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I haven't used this method in a long time because now I use UUID()s as my unique record identifier and since I create the UUID before I do the Insert, I have access to it. > > I don't have the syntax handy, but are you using the SET NOCOUNT ON and SET NOCOUNT OFF? That might be it. > > FWIW, I have read some research that @@IDENTITY will not always provide you with the proper ID, especially in multi-user environments (which the web most certainly is) and leaves the possibility of returning the wrong IDENTITY id. This is why I switched to using UUID's. > > Dave > > -----Original Message----- > From: Dan O'Keefe [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 17, 2005 10:12 AM > To: CF-Talk > Subject: Re: @@Identity returns excessive records > > > If I copy and paste my tSQL into query analyzer: > > INSERT INTO tblArActivityNote (patientID,UserID,note) > VALUES(238,1,'Letter 2 printed & mailed for DOS(s)' + ' 01/19/04') > go > select @@IDENTITY as ID from tblArActivityNote > go > > My PK-IdentityID column in tblAractivityNote is AractivityNoteID. If > the insert created a AractivityNoteID= 295256, the select @@identity > returns 295256 rows with the same value, 295256. > > Weird, huh? > **************************************************************************** ************** > The information contained in this message, including attachments, may contain > privileged or confidential information that is intended to be delivered only to the > person identified above. If you are not the intended recipient, or the person > responsible for delivering this message to the intended recipient, ALLTEL requests > that you immediately notify the sender and asks that you do not read the message or its > attachments, and that you delete them without copying or sending them to anyone else. > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:215419 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