quarta-feira, 3 de setembro de 2014

TSQL RowNum from Oracle equivalent, and the PhysLoc column


I was looking for the Row_Number() sintax on Internet:
SELECT *, ROW_NUMBER() OVER (ORDER BY [column name]) as rowNum
FROM [table name]
order by ROW_NUMBER() OVER (ORDER BY [column name])

And I have found this, as a gift:

SELECT  id, %%PhysLoc%% from dbo.A ORDER BY %%PhysLoc%%;
                                             
In Oracle we used to use something like that to improve performance in updates, specially in non-normalized tables where PK was not set yet, and sometimes better than a PK index. 

Nenhum comentário:

Postar um comentário