I am trying to run ORDER BY on a huge dataset and create dense rank values to extract a different number of rows based on dense rank. In general, I use the dense ranking value as a surrogate key in my entire process to transfer intermediate results and use them for some performance checks.
The problem I am facing: -
The problem I encountered is moving the dataset from Matrix (postgresql) (PRODUCTION environment) to SQL Server (new environment) and the dense ranking function is implemented. But due to the presence of different dense rank results, which are caused by the behavior of ORDER BY in SQL Server and Matrix, I can not continue checking the code and results.
Test example:
SELECT *,DENSE_RANK() OVER ( ORDER BY Col ) AS drnk FROM
(
SELECT '#2 Mayfair Terrace' AS Col
UNION
SELECT '#2 MYSTIC COURT' AS Col
)Z;
SQL Server output:
Col drnk
Matrix (Postgresql): -
Col drnk
- , ORDER BY ? . .