SQL vs Access…what you NEED to know to do both and create a VIEW


SQL vs Access…what you NEED to know to do both and create a VIEW
Jeff Shirley
30 March 2018
Moving between SQL and Access there are a few tricks you need to know. I thought it would be good to show some common areas which are stumbling blocks:

Access vs SQL
CInt and CString use Cast or Convert (depending on scenario)

Nz([Field1,null) use Coalesce([field1],[field2],null, ….)

“string” use ‘string’

#date# use ‘date’

append query use insert

Like “*string” use like ‘%string’ (the % is the wildcard)

dbo_tblname use dbo.tblname (the linked table can’t hold a “.” in it, and replaces it with an “_”.

Query create View

Creating a VIEW to use in Access:
For moves to SQL, think about switching to Views for your larger power queries. This will radically improve your database and the results of your queries.

Build queries in Access.
Change view to SQL View.
Copy the code.
Go to SSMS.
Create a new View.
Paste the code.
Clean up the syntax (see above).
Execute, test and debug.
Save as a new View.
In access link to the view and don’t use your query.
Result = WAY FASTER QUERIES! Views run server side on SQL Server, Queries are hit and miss and tend to pull data locally and run client side. If you like this, say “thanks Jeff!”. You’re welcome!

Related Posts

Access 2016 Relationships

Short blog today, this is a great read on relationships in Access 2016: Access 2016 Relationships Thanks to Microsoft for this one!

Microsoft Access Union Query from Hell. Skill Level: Demi-God

The worst query I ever had to write which powers a master report for the database user.  Here it is.  I don't think I can make it smaller, there were too many weird rules, aggregates, and translations in it.  And we needed to pull different columns based on criteria. ...

MDE vs MDB and ACCDB…confused?

Only because this was an issue for several people over the last year who called us...note the following: Older Access databases end in .mdb (Access 2003 or earlier) Newer Access databases end in .accdb (Access 2007 and later) If you compile a database (Click File,...