when used ROW_NUMBER () in the below query .. it takes 20 sec to return 35,000 rows,.
WITH test_CTE as(
, ROW_NUMBER() OVER (ORDER BY InvoiceNumber) AS Row
-- this takes 20 sec for 35,000 records.
-- If Row_Number() commented, it only takes 2 sec.
I basically need a row number based on InvoiceNumber.. how should i tweek my query
Thanks for the help guys
Environmet:- Sql server 2008 r2