07-31-2023, 09:55 AM
This might have already been answered a long time ago... but from SQL 2005 onwards you can use the `ROW_NUMBER` function... an example would be:
select ROW_NUMBER() OVER (ORDER BY productID) as DynamicRowNumber, xxxxxx,xxxxx
The `OVER` statement uses the `ORDER BY` for the unique primary key in my case...
Hope this helps... no more temp tables, or strange joins!!
select ROW_NUMBER() OVER (ORDER BY productID) as DynamicRowNumber, xxxxxx,xxxxx
The `OVER` statement uses the `ORDER BY` for the unique primary key in my case...
Hope this helps... no more temp tables, or strange joins!!