We help IT Professionals succeed at work.

Converting Access Application to SQL Server

153 Views
Last Modified: 2019-02-10
I'm using the SQL Server Migration Assistant for Access to move an Access database to SQL Server.  Many of the queries failed to migrate.  Here is an example of one:

UPDATE ttbl_Equian_Clients, qryEquian SET qryEquian.Parent = IIf([AccountName]="Equian",[ClientName],[AccountName]), qryEquian.[Employer/Insured] = [ClientName], qryEquian.payor = IIf([AccountName]="Equian",[ClientName],[AccountName]), qryEquian.[claim admin] = IIf([AccountName]="Equian",[ClientName],[AccountName])
WHERE (((ttbl_Equian_Clients.[Client ID])=Left([CLAIM NUMBER],4) Or (ttbl_Equian_Clients.[Client ID])=Left([CLAIM NUMBER],5)));

Open in new window


How do I fix such a query and manually migrate it?  I can easily turn that into a stored procedure, but how does Access then know to use the stored procedure?

Apologies if I seem a bit dumb, this project kinda got thrown at me and I'm a SQL Server guy, not an Access guy.

James
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
SSMA is for migrating tables and schemas, and will also convert simple queries.
The "difficult" queries, however, it is not good at. Those you will have to handle manually.
Wayne BarronAuthor, Web Developer
CERTIFIED EXPERT
Top Expert 2009

Commented:
Hey, James.
What are the errors you are getting?

Author

Commented:
I'm getting three basic errors depending on which query failed:

A2SS0061: The identifier 'IIf(BOOLEAN, UNKNOWN, NUMERIC)' was not converted.  --- I assume here I'll need to manually make a new query using SELECT CASE WHEN END.

A2SS0069: External variable cannot be converted.  ---  The query is referencing field on a form.  I'll have to have the form save data to SQL Server first - maybe to a temp table.

A2SS0061: The identifier 'Month(UNKNOWN)' was not converted.  --- Convert to SQL Server date time commands.

So I can create views, stored procedures, and so on all day in SQL.  How do I get Access to use them instead of the queries it has?  Is there a link command or something?

James
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
It's not just like that.
But several guides can be found for the browsing. Too large a subject for a tiny question.

Author

Commented:
Ok, let me ask this:  Queries that are converted from Access to SQL Server then become pass-through queries in Access, correct?

James
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
No, they could be views that are linked. Also, PT queries are read-only which, in many cases, is useless.

But there is no right or wrong method, it all depends. An application may run fine with no converted queries at all - leaving the job to the ODBC driver. Most start there, then localise bottlenecks, if any, and then work with these.

Author

Commented:
Gustav,
Ok, we are getting somewhere.  The vast majority of queries in the Access database are SELECT so they can all become views.  I'm totally fine with that.  The handful of Update queries I was going to make into Stored Procedures in SQL Server.  How would I reference those in Access if Pass-through is not an option for them?

James
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

Commented:
Very good.  Thank you for the assist.

With over 400 queries and right at 300 of the failing the migration assistant, I do have some work ahead of me.  But most of it is changing DATE() to GETDATE() and IIF() to SELECT CASE.  I just needed to know how Access references the new objects once moved to SQL Server.

James
CERTIFIED EXPERT
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
You are welcome!

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions