I have one table CSBCA1_5_FPCIC_2012_EES207201222743
, having two columns employee_id
and employee_name
I have used following query
SELECT ROW_NUMBER() OVER (ORDER BY EMPLOYEE_ID) AS ID, EMPLOYEE_ID,EMPLOYEE_NAME
FROM CSBCA1_5_FPCIC_2012_EES207201222743
But, it returns the rows in ascending order of employee_id
, but I need the rows in order they were inserted into the table.
This question is related to
sql
sql-server-2005
rowid
There is a pseudocolumn called %%physloc%% that shows the physical address of the row.
SQL does not do that. The order of the tuples in the table are not ordered by insertion date. A lot of people include a column that stores that date of insertion in order to get around this issue.
Source: Stackoverflow.com