Friday, December 2, 2022

Row number SQL without order by column

 SELECT

    ROW_NUMBER() OVER(ORDER BY (Select 0)) AS Row_Num,
    Employee_Name
    FROM MTB_Table_A


SELECT actid, tranid, val,
 ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) AS rownum
FROM dbo.Transactions;



reference:- https://www.mytecbits.com/microsoft/sql-server/row-number-without-using-order-by

https://stackoverflow.com/questions/44105691/row-number-without-order-by

No comments:

Post a Comment