Access DB migrate to SQL Server (1 Viewer)

eugzl

Member
Local time
Today, 03:38
Joined
Oct 26, 2021
Messages
125
Hi All.
I have the Access DB with a huge amount of macros that manage queries and files in explorer. The database file has almost reached its size limit (2 GB). I have an idea to migrate it to SQL Server. Questions:
1. Is it worth to do it?
2. If yes. Should I migrate all tables or queries as well? I certainly understand that I will have to recode queries to SQL Server rules in that case.
3. If I will migrate tables and queries and then connect the Access DB to SQL Server. Will all my macros and other VBA codes work?

Thanks
 

CJ_London

Super Moderator
Staff member
Local time
Today, 08:38
Joined
Feb 19, 2013
Messages
16,612
1. maybe - you can't exceed the 2Gb limit, but have you compact/repaired? are there records that can be deleted? Are you using multivalue fields or tables with attachments? The former won't work in QL Server, the latter should be stored outside the db and you store a path instead
2. certainly tables, queries possibly. If you use domain functions or crosstab queries they will need a major rewrite
3. probably - in principle you may need to tweak them, all depends on what they do
 

eugzl

Member
Local time
Today, 03:38
Joined
Oct 26, 2021
Messages
125
1. maybe - you can't exceed the 2Gb limit, but have you compact/repaired? are there records that can be deleted? Are you using multivalue fields or tables with attachments? The former won't work in QL Server, the latter should be stored outside the db and you store a path instead
2. certainly tables, queries possibly. If you use domain functions or crosstab queries they will need a major rewrite
3. probably - in principle you may need to tweak them, all depends on what they do
Hi CJ_London. Thanks for reply.
I cleaned the database and left only what is necessary. And size of DB indicate 1.8GB.
An other questions. In case if database will migrated. Can I expect that it will work faster? Also, I very worry about how will work macros and VBA codes if tables and queries will located on SQL Server?

Thanks
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:38
Joined
Oct 29, 2018
Messages
21,473
Is your database split? How big is the FE? How big is the BE?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:38
Joined
Oct 29, 2018
Messages
21,473
Hi theDBguy. Thanks for reply.
The database not split. What mean FE and BE?

Thanks
Try splitting it up first. Maybe you won't need to use SQL Server yet. You split the database by putting all the tables into a BE file and leave all the forms, reports, queries, and code in the FE file. BE means BackEnd, and FE means FrontEnd.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 08:38
Joined
Feb 19, 2013
Messages
16,612
In case if database will migrated. Can I expect that it will work faster?
no - at best it will be about the same but more likely to be slower. Comparison depends on where your app is located - if on your machine, it will definitely be slower

The database not split. What mean FE and BE?
FE means Front End (all forms, reports, queries*, macros and vba
BE means Back End and is just tables - this is the bit that gets migrated to SQL Server

*you can continue to use the queries in the FE but it may be more efficient to move them to the BE if they are complex or SQL Server has more more efficient functionality not available in Access (such as recursion). See this link
https://www.access-programmers.co.uk/forums/threads/addressing-performance-issues.291269/



Since your app is not split, presumably it is not multi user
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 03:38
Joined
Feb 19, 2002
Messages
43,275
In case if database will migrated. Can I expect that it will work faster?
Jet and ACE are very fast and are optimized for working with Access. Just moving the data to SQL Server will almost certainly result in a much slower application. When I develop applications, I always use good client/server techniques. So, even though the app may run for a couple of years using Jet/ACE before the size or the number of concurrent users dictates a conversion, I can convert in an afternoon in all cases unless I run into some data issue. It can even take less time but there is a lot of testing that has to take place to ensure that every form/report/query/piece of code is working as expected with the new BE. And the converted app will be as fast or faster.

WHY? planning. Access applications are frequently built by amateur's who use macros and sloppy code (if they write any) as well as local filtering. When your form is bound to a table or to a query without any selection criteria, it is like using a straw to suck down all the rows from the server. The form is displayed as soon as enough data has been retrieved to fill it but then Access just sits back and sucks and sucks and sucks until ALL the rows from the table or query are local and this is EXACTLY what makes the converted app so slow. The point of using a server based BE is to restrict dramatically the amount of data that is dragged over the network. Therefore, all your forms/reports need to be bound to queries that have selection criteria that severely limit the number of rows requested. In the case of forms, preferably to ONE.

So, instead of bringing all the data down and letting the user filter it locally, you get the user to determine what he wants to see and use criteria with queries to select only what he needs. I use two kinds of "filtering" methods. One is a form with all the criteria options. The "run" button assembles all the criteria into a where clause. It runs a dCount to determine how many records would be selected. If the answer is ONE, the search form opens the main edit form to the one record selected. If the answer is too many, I give the user an option to go back and select more options before returning the data. Then for the not one case, the app opens a non-editible list form with the most appropriate fields for letting the user select a record. Then the double-click event on the ID of a row in the form opens the standard main edit form for the one record selected.

If you have code with loops whether they be VBA or macros, you need to clean them up to make sure you are not executing instructions inside the loop that should be executed outside the loop.

In order to know how bad your situation is, make a few backups and then attempt to do a straight upsize. Run the app. Start working on speeding up the slow parts.

There is no reason to start by converting all your querydefs or embedded SQL to T-SQL and stored procedures. That is the last resort. Once you clean up all that you can with the way the forms work and any batch processing that uses loops, you can start by trying to optimize the queries. You will need to look at joins and search criteria and indexes to determine if they are appropriate. Sometimes creating a view on the server will ease the pain with a commonly performed join or calculation like concatenating the first and last names into one field.
 

Users who are viewing this thread

Top Bottom