Sorting Problems when moving access adp app from SQL Server 2000 to SQL Server 2008
-
30-09-2019 - |
Question
We are testing our MS Access application against a new SQL Server 2008 database server. We have forms that sort alphabetically because of an order by in the view, the sort is correct when the access application is connected to the SQL Server 2000 Database.
However, when I connect to our new 2008 database, those sorting properties change - the application appears to sort by the primary key. I read some MS docs that suggest that access may be using a clustered index in one of the tables in the view to make its sorting decisions. Thereby overriding the sorting in the view.
Has anyone seen any problems similar to this? If so what were workarounds for this problem?
Thank you.
Solution
the order by in the view is ignored, if you have
create view yourView as
select ...
ORDER BY col1
the order by will be ignored and the returned result will be returned in the order of an index (clustered most likely)
to guarantee order you have to do:
select ... from yourView ORDER BY col1
and remove the order by from the view itself