Rx_
Nothing In Moderation
- Local time
- Today, 08:04
- Joined
- Oct 22, 2009
- Messages
- 2,803
This is a fact. Stumbled across the internet article and posted it on the 3rd post.
Never Ever use an Order By in a SQL Server View.
The reason is explained on the post below.
It is not an ODBC thing. It is a SQL Server thing.
Question #1 Does your database linked table have this same results?
- please list Access / SQL / ODBC versions if yours keeps sort order -
See attachment: A SQL View has 2 sort orders. One the ID_Wells (first Column) and the 2nd sort (descending) on DT_APD_Sub
In SQL Server 2008 r2, it shows up perfectly.
Using vba to create a Linked Table using SQL Server Native Client 11.0
On MS Access, just double-click the linked SQL Server view.
As the attachment shows, it doesn't keep either of the sorted orders.
Question #2 "why did this astound me?"
Keep in mind, a can-opener still baffles me when it is my turn to cook. Me bang can with rock.
The ID_Wells are ascending order and the dates in descending order. On the SQL Server side this view looks perfect!
On the Linked Table side of Access - both the sorted fields act somewhat randomly.
The view is against a table with field of datetime data types.
Since I open a query against this view, I guess that the sorted order will be re-applied. Was just surprised that What-you-see on SQL view is NOT what-you-get on the Linked Table side.
Never Ever use an Order By in a SQL Server View.
The reason is explained on the post below.
It is not an ODBC thing. It is a SQL Server thing.
Question #1 Does your database linked table have this same results?
- please list Access / SQL / ODBC versions if yours keeps sort order -
See attachment: A SQL View has 2 sort orders. One the ID_Wells (first Column) and the 2nd sort (descending) on DT_APD_Sub
In SQL Server 2008 r2, it shows up perfectly.
Using vba to create a Linked Table using SQL Server Native Client 11.0
On MS Access, just double-click the linked SQL Server view.
As the attachment shows, it doesn't keep either of the sorted orders.
Question #2 "why did this astound me?"
Keep in mind, a can-opener still baffles me when it is my turn to cook. Me bang can with rock.
The ID_Wells are ascending order and the dates in descending order. On the SQL Server side this view looks perfect!
On the Linked Table side of Access - both the sorted fields act somewhat randomly.
The view is against a table with field of datetime data types.
Since I open a query against this view, I guess that the sorted order will be re-applied. Was just surprised that What-you-see on SQL view is NOT what-you-get on the Linked Table side.
Attachments
Last edited: