How to get rows in sequence storeprocedure
country
countryid countryname
1 India
2 USA
3 Russia
Lastcountryid table
lastcountryid
I want to storeprocedure to get one record from country table but in sequence
for eg.
select top 1 from country
it will return 1 India and at the same time run the update in lastcountrytable with return id
update lastcountryidtable set lastcountryid =1
then when i run the storeprocedure next time it should return 2 USA bcs last countryid store in other table is 1
when i run it storeprocedure third time so it should return 3 Russian bcs last countryid store in other table is 2