Sqlserver
 sql >> Base de Dados >  >> RDS >> Sqlserver

SQL Server AutoIncrement variando por valor de outro campo

select pk1,pk2,ROW_NUMBER() over (partition by pk1,pk2 order by (select 0)) as AIfield
from yourtable