set nocount on
insert into tbl....
select @@identity as newid
set nocount off

-----Original Message-----
From: Stuart Kidd [mailto:[EMAIL PROTECTED]
Sent: 18 April 2005 11:48
To: CF-Talk
Subject: Last ID inserted




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





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:203179
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

Reply via email to