Why is my Access 2010 ADP not filtering its SQL statements when connected to MSSQL 2008 R2?

2

1

I use MSSQL MS for most administrative tasks on SQL Server 2008 R2 databases, but I find using Access (via an ADP, not linked tables) to view and edit raw table data to be much more efficient. (This is for sysadmin use only, of course, user access is via a web app, and the tables in question are relatively small, maybe a few thousand rows.)

However, since switching to Access 2010, performance tanked when filtering and sorting tables in an ADP, and watching it via Profiler, I know why -- Access is not only not preparing a WHERE clause for MSSQL to implement the filters, it is asking for the raw table multiple times, regardless which filters are in place. In other words, it does something like this:

SET ROWCOUNT 10000 
SELECT "dbo"."MYTABLE".* FROM "dbo"."MYTABLE"
SET ROWCOUNT 0 
SELECT "dbo"."MYTABLE".* FROM "dbo"."MYTABLE"
SET ROWCOUNT 10000 
SELECT "dbo"."MYTABLE".* FROM "dbo"."MYTABLE"
SET ROWCOUNT 0 
SELECT "dbo"."MYTABLE".* FROM "dbo"."MYTABLE"

(I left out a few extra statements where it is reading extended column properties.)

What the heck is Access doing here, and how can I make it use SQL Server to perform the filtering and sorting, and to not make multiple trips every time the table filters are changed?

richardtallent

Posted 2012-10-16T14:31:43.807

Reputation: 1 052

This is a good question, and I don't know the answer, but my intuition tells me that it's using client-side recordset objects and/or bringing the server data over as a copy (in RAM) into a JET/OLEDB database and then using OLEDB to do the filtering. Why in the world it would do that when backed by a SQL server, I have no idea. Maybe it's a setting in the ADP? Maybe it's the driver you used to connect to SQL from the ADP? Certain drivers only support client-side recordsets, while others are more featureful and support server-side. – allquixotic – 2012-10-24T21:51:23.663

A long shot : try this.

– harrymc – 2012-10-25T06:52:06.113

Apparently I don't have a high enough reputation here to answer my own question, but I found a workable solution. I created a VIEW in MSSQLSM that selects rows from my table based on filters I have in a row in a scratch table designed just for that. I can then edit rows in Access by editing within the view and it is ORDERS OF MAGNITUDE faster. Just have to edit my filter row (which I keep open in another window) and refresh the view as needed. – richardtallent – 2013-04-05T18:07:04.103

No answers