ROW_NUMBER() OVER (ORDER BY 'Column_Name' DESC) as ROW_NUMBER
select ROW_NUMBER() OVER(PARTITION BY WorkOrderID ORDER BY WorkOrderID ASC)
AS Row#, * from TableName
SELECT
ROW_NUMBER() OVER (
ORDER BY first_name
) row_num,
first_name,
last_name,
city
FROM
sales.customers;
SELECT
ROW_NUMBER() OVER (
ORDER BY first_name
) row_num,
first_name,
last_name,
city
FROM
sales.customers;
SELECT
ROW_NUMBER() OVER (
ORDER BY salary
) row_num,
first_name,
last_name,
salary
FROM
employees;
Code language: SQL (Structured Query Language) (sql)