r/SQLServer • u/FranceRocks2 • May 11 '26
Question SQL Server join against linked server mapping to MS Access database works sometimes, sometimes crashes the SQL Server instance.
There is a legacy MS Access database that has a table needed for a query. Occasionally when accessing the table from SQL Server, the SQL Server instance just crashes. In other words, the SQL Server process is killed and noone can access sql server until it is restarted. Some of the information I have read say it is a known issue, and recommended using OPENQUERY as opposed to prefacing the database name with the linked server. That seems to work better, however even OPENQUERY crashes sql server sometimes. What seems to always best is if I manually in SQL Mgmt studio expand the linked server to display the tables. However we have an automatic process that needs to run without any manual intervention. Any suggestions for manual queries to 'prime' sql server so it does not crash when accessing that data?
16
u/tompear82 May 11 '26
Why don't you just permanently move the dataset to a table on the SQL server instance instead?
6
u/VladDBA Microsoft MVP May 11 '26
Define "crashes the SQL Server". Are you getting an error? If yes, add it here. What does the error log and/or event viewer record at that point?
Also, as others have mentioned, do not join with tables on linked servers, pull those tables on the SQL Server instance and then join on those instead of their Access counterparts.
4
u/iPlayKeys May 11 '26
Just don’t. This will never be reliable. You’re better off to keep a cached copy on SQL server and update it periodically…but make sure you have error handling around this so that if something goes wrong during the sync process that the cache doesn’t get purged.
4
u/dinosaurkiller May 11 '26
Access or the drivers that allow the link are likely experiencing memory issues which are bleeding over into the SQL Server during the data transfer. Move that table permanently from Access into SQL Server and periodically update it if needed.
3
u/SuperDuperDBA May 11 '26
Move the data to SQL server. point access application to that table on SQL Server.
step 2: delete Access.
2
u/imtheorangeycenter May 11 '26
Does legacy mean "doesn't change much, if at all"?
In which case, use the data migration tool from MS to rehouse the whole lot in SQL Server (and keep the front end!), or..
Migrate the sunset of data over using SSIS/ADF/other once in a while as appropriate.
Linked servers to Access/excel/other office formats are the worst of all of them, relying on the right ACE drivers. And god help you if the server team updates the version because "they are a decade out of support".
2
u/k00_x May 11 '26
SQL gore
2
u/Playful_Guava1180 May 11 '26
Does the openquery have complex joins? you may have to run separate subsets then merge them in the destination db
2
u/pablomango May 11 '26
You can use python to connect to the ms access DB, pull the data and populate it to a temp table in SQL Server and then join to whatever you need on the instance. Works really well for me. Assuming youre dealing with less than, say, a million rows in ms access.
1
u/FranceRocks2 May 11 '26
I just wanted to thank every single person here for your reply. Really helpful!!!
1
u/CPDRAGMEISH May 11 '26
IT'SG OK
Error ?
-
SQLServer log ?