declare @temp table(patnum int, rownumber int)
insert into @temp (patnum,rownumber)
select 123,null union
select 123,null union
select 123, null union
select 456, null union
select 456 , null union
select 689 , null
i want incremental numbers to be inserted into rownumber field. It should start with 1. Rownumber should change only when PAtno changes. Can somebody help.
so, the result would be.
Patno Rownumber
123 1
123 1
123 1
456 2
456 2
689 3
NSG12