Hi All,
I have a doubt about paging with SQL 2000 dialect.
I did a simple test, using IQuery interface in both SQL 2005 and SQL
2000. In SQL 2005 I liked too much the query NH generated (using
Row_Number() SQL Server function), but in SQL 2000, NH just made a
“select Top N” from the table.
Is that the expected behavior? Imagine a table with lots of rows, the
performance would not be good… If there is no other way to paging in
SQL Server 2000, I’ll have to do the paging methods using pure
ADO .Net with some customized queries (and I really don’t want to do
this).
Here is the NH query:
-------------------------------
IList< RegiaoFiscal> objetos = session.CreateQuery("from RegiaoFiscal
rf")
.SetFirstResult
(18)
.SetMaxResults(5)
.List<BE.RegiaoFiscal>();
-------------------------------
Here is the query generated for SQL 2005:
-------------------------------
SELECT TOP 5 ReF1_0_, ReF2_0_ FROM (select regiaofisc0_.ReF_Cod as
ReF1_0_, regiaofisc0_.ReF_Des as ReF2_0_, ROW_NUMBER() OVER(ORDER BY
CURRENT_TIMESTAMP) as __hibernate_sort_row from tblRegiaoFiscal
regiaofisc0_) as query WHERE query.__hibernate_sort_row > 18 ORDER BY
query.__hibernate_sort_row
-------------------------------
Here is the query generated for SQL 2000:
-------------------------------
select top 23 regiaofisc0_.ReF_Cod as ReF1_0_, regiaofisc0_.ReF_Des as
ReF2_0_ from tblRegiaoFiscal regiaofisc0_
-------------------------------
Thanks in advance.
Best regards,
Renato Duran
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---