Converting Access Application to SQL Server

JamesNT
JamesNT used Ask the Experts™
on
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

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
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
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
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

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
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
Most Valuable Expert 2015
Distinguished Expert 2018
Commented:
A PT query is certainly a candidate for an update query. And it is executed the same way.

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
Most Valuable Expert 2015
Distinguished Expert 2018

Commented:
You are welcome!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial