Help for this page
select agent,max(id) into agent_id from tracker group by agent
begin tran set nocount on ... set ID = ID + 1 where Name = 'abc' select ID from agent_id where Name = 'abc' commit tran