SELECT @@IDENTITY is all you need.
-----Original Message----- From: JediHomer [mailto:[EMAIL PROTECTED] Sent: 18 April 2005 11:53 To: CF-Talk Subject: Re: Last ID inserted SET NOCOUNT ON INSERT INTO tableUsers (blah) VALUES (moreblah) SELECT InsertedID = Scope_Identity() SET NOCOUNT OFF HTH On 4/18/05, Stuart Kidd <[EMAIL PROTECTED]> wrote: > > > Hi guys, > > I am inserting to a few tables at once (ms-sql, cf7.0). > > One table will insert into the tableUsers and then I will insert into tableQuestions. In tableQuestions i will want to put the contents of the userID which i just inserted into tableUsers. > > Can anyone tell me how I can get the exact userID which I just inserted so I can put into my tableQuestions table? > > I know of MaxID (or something like that) but i am worried that in some cases there may be more than one person accessing the DB and I may grab the incorrect information. > > Any ideas would be appreciated. Thanks, > > Saturday > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:203187 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=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

