Expert guide

AI-Assisted Access to SQL Server Migration

SSMA moves the tables. AI speeds up the queries, code and testing that decide whether it works.

Short answer: use SQL Server Migration Assistant for Access to move tables, keys and data, then use AI to translate Access queries into T-SQL views, scan VBA for patterns that break on linked SQL tables (dbSeeChanges, AutoNumber timing, Seek, date and wildcard syntax), and draft test cases. AI shortens the slowest phase, fixing and testing, but every translated query still needs verification against real results. For a fixed-scope migration, see Access to SQL Server migration.

Most Access to SQL Server migrations follow the same arc. Tables move in an afternoon. Then the forms get slower instead of faster, a few buttons throw errors, a monthly report returns different totals, and the project drags on for weeks. The tables were never the hard part; the hundreds of queries and VBA procedures written for Access's engine are.

AI is genuinely good at that hard part: reading Access SQL and VBA, explaining it, translating it and spotting known problem patterns. Used well, it compresses weeks of tedious review into days. Used carelessly, it introduces subtle differences in results.

Where AI Helps, Phase by Phase

PhaseMain toolHow AI helps
Discovery and documentationExport of queries, forms, modulesExplains each object, lists dependencies, flags risks
Schema migrationSSMA for AccessReviews data type mappings and suggests indexes
Query conversionViews, stored procedures, pass-through queriesTranslates Access SQL to T-SQL
VBA remediationManual code changesScans for breaking patterns and proposes fixes
TestingSide-by-side result comparisonDrafts test cases and comparison queries
CutoverRunbook and relinkingDrafts the runbook checklist

Phase 1: Document Before You Move Anything

Export every query's SQL and every module as text, then use AI to classify them: still used or dead, read or write, heavy or light. The full routine is in documenting a legacy Access database with AI. Retiring dead objects before migration is the cheapest performance win available.

Phase 2: Move Tables With SSMA, Review With AI

  • Run SSMA for Access to create the SQL Server schema and migrate data.

  • Export the SSMA assessment report and the generated table definitions.

  • Ask AI to review the mappings: Currency to money or decimal, Date/Time to datetime2, Yes/No to bit with a default, Long Text to nvarchar(max).

  • Ask it to propose indexes on every foreign key and on fields used in WHERE clauses of your heaviest queries.

  • Add a rowversion column to tables edited through forms; Access uses it to detect changes efficiently.

Phase 3: Translate Heavy Queries to T-SQL

Not every query needs translating. Simple selects on linked tables run fine. Translate the ones that are slow or use Access-only functions.

Prompt:
Translate this Microsoft Access query to a SQL Server T-SQL view.
- IIf → CASE, Nz → ISNULL/COALESCE, & → + or CONCAT, # dates → 'yyyy-mm-dd'
- DLookup/DSum → joins or correlated subqueries
- Format() for grouping → FORMAT or CONVERT, prefer date arithmetic
- Keep column names identical so forms and reports still bind.
- List anything whose behaviour may differ (nulls, rounding, collation).

Access SQL:
SELECT c.CustomerID, c.CompanyName,
       Nz(DSum("Amount","tblInvoices","CustomerID=" & c.CustomerID & _
           " AND Paid=False"),0) AS OpenBalance,
       IIf(OpenBalance>10000,"Review","OK") AS Flag
FROM tblCustomers AS c;
Expected T-SQL view:
CREATE VIEW dbo.vwCustomerOpenBalance AS
SELECT c.CustomerID, c.CompanyName,
       ISNULL(i.OpenBalance, 0) AS OpenBalance,
       CASE WHEN ISNULL(i.OpenBalance, 0) > 10000 THEN 'Review' ELSE 'OK' END AS Flag
FROM dbo.tblCustomers AS c
LEFT JOIN (SELECT CustomerID, SUM(Amount) AS OpenBalance
           FROM dbo.tblInvoices WHERE Paid = 0
           GROUP BY CustomerID) AS i
  ON i.CustomerID = c.CustomerID;

Link the view in Access with the old query's name, or point the form's record source at it, and the form now gets one pre-aggregated result from the server instead of running a DSum per row.

Phase 4: Scan VBA for Breaking Patterns

PatternWhy it breaksFix
OpenRecordset without dbSeeChangesError 3622 on tables with identity columnsAdd dbOpenDynaset, dbSeeChanges
Reading !ID right after AddNewIdentity value assigned only after UpdateRead it after .Update with .Bookmark = .LastModified
.Seek or dbOpenTableNot supported on linked tablesUse FindFirst or a filtered recordset
SQL strings with # dates or * wildcards in pass-throughT-SQL syntax differsUse 'yyyy-mm-dd' and %
Yes/No compared to -1 (True)bit is 1 on SQL ServerCompare to True or <> 0
Long transactions holding locksBlocks other users on the serverShorter transactions, set-based updates
Prompt:
Here is an Access VBA module. The tables will become linked SQL Server
tables with identity primary keys and bit fields for Yes/No.
List every line likely to break or slow down, why, and the corrected code.
Do not change behaviour beyond what the migration requires.

Phase 5: Test by Comparing Results

  • Keep a copy of the pre-migration Access database as the reference.

  • For each important query and report, run it on both, export to Excel, and compare row counts and totals.

  • Ask AI to draft a test list from your documentation: every form action that writes data, every report used monthly.

  • Test with several users at once; concurrency problems do not show up in single-user testing.

  • Time the slowest forms before and after; performance is often the reason for migrating.

Where AI Is Not Enough

  • Deciding what to migrate, what to retire and what to rebuild.

  • Security design: logins, roles and which users can see which tables.

  • Backup, maintenance plans and hosting decisions.

  • Judging when a translated query is 'equivalent enough', especially with nulls, rounding and text collation.

  • Cutover planning when people use the database every day.

Before migrating, check whether you actually need to: the Access 2 GB limit and ODBC call failed errors guides cover common triggers. If SQL Server is the right move, our migration service uses these AI-assisted steps inside a fixed-scope plan, with testing and cutover included.

FAQ

AI and Access to SQL Server migration FAQ

Queries, code, testing and timelines

Not on its own. Microsoft's SQL Server Migration Assistant (SSMA) for Access moves tables and data. AI speeds up the work around it: translating Access queries to T-SQL, finding VBA that will break, rewriting slow domain functions as server-side views, and documenting the database before you start.

Queries that use Access-only functions such as IIf, Nz, DLookup, DSum, Format and user-defined VBA functions, crosstab (TRANSFORM/PIVOT) queries, and queries that reference form controls. They often still run against linked tables, but Access pulls data locally to evaluate them, which is slow. Rewriting heavy ones as SQL Server views or pass-through queries is where performance comes from.

Common issues are DAO recordsets on tables with identity columns that need dbSeeChanges, code that reads a new AutoNumber before saving, Seek and table-type recordsets that do not work on linked tables, Yes/No fields that become bit fields with different null handling, and date or wildcard syntax in SQL strings.

Schema, SQL and VBA rarely contain customer data, but may contain server names and credentials. Remove connection strings and passwords, and use a business AI plan that does not train on your inputs. Never send production data samples unless your policy allows it.

Moving tables with SSMA can take a day. The work that determines the timeline is testing and fixing queries, forms and code, which depends on how much logic the database has. Documenting first and using AI to triage queries and code can shorten that phase considerably.