Good post, Albert.
Yes, they are VERY similar. A view in sql server is some saved
sql. And, in ms-access we can save a query and use that in place
of table.
One other difference is that you can link to a server-side view, but
you can't link to a saved QueryDef in another Access database. This
limiation can be gotten round by using IN 'C:\MyOther.mdb' in the
FROM clause in a query.
The only real difference here is that in ms-access we can save sql
that updates tables (update/delete quires etc). These types of
quires are often called action quires (action queries don't return
records...but they update or delete data). In sql server, that
saved sql is a view,but the sql can't update data or delete data.
I think a mention of stored procedures would be appropriate here.
In Access, you have saved querydefs, regular queries and action
queries.
In server databases, a regular non-action query is called a VIEW.
Action queries can be saved as stored procedures.
In addition to being like a saved action query, a stored procedure
can also include procedural code and branching logic, something that
is not available in Jet/Access in any form.
[]
So, in ms-access if you hit ctrl-g to get to the debug window and
type in:
currentproject.Connection.Execute "create view MyView as select
Company from tblCustomers"
After you execute the above you see a standard query called MyView
that is a select statement. So, even ms-access does support the
create view command. The above command does NOT work if you use
the built-in dao connection UNLESS sql ansi is turned on. so:
currentdb.Execute "create view MyView as select Company from
tblCustomers"
Will NOT work unless sql ANSI compatibility is turned on. However,
using the built ADO (currentproject.Connection) object does work
regardless if sql ANSI compatibility is turned on or not..
This is to be expected, as CurrentProject.Connection returns an
object of type ADO.Connection, so it should stand to reason that any
SQL you pass to it its Execute method would run under ADO's rules.
By using a "CREATE VIEW" SQL statement, you're getting into the
other kind of SQL, DDL (data definition language). There are three
kinds of SQL:
DDL -- data definition language, for creating and altering the
structure of tables, views and stored procedures.
DML -- SQL statements that alter data, INSERT, UPDATE, DELETE.
SELECT -- SQL statements that return data from tables.
In Access, these distinctions are elided and everything is just a
query.
Also, historically the Access/Jet documentation has downplayed the
use of DDL in favor of DAO. Jet/ACE DDL is not fully compatible with
many other SQL dialects, and not all features of Jet/ACE
tables/fields are manipulable through Jet/ACE DDL.
I expect this is something that is going to change, as well as that
the historical SQL dialect that is based on a snapshot of SQL 89
with interesting additions will probably be replaced sometime soon
as the Access team gets up to speed on managing their own private
version of Jet/ACE. That is, I would expect alterations to Jet/ACE
SQL to make it more compatible with common SQL dialects.
I expect this to be implemented the way MS introduces any such
migration from one set of standards to another, in a manner that is
backwardly compatible. My guess is the so-called SQL 92 mode will be
further extended for even greater compatibility and eventually take
over as the default.
This is not a big deal when you look at the big picture, and my
guess is that it will be implemented in a way that will not cause
incompatibilities. Access developers have been dealing some of these
issues (e.g., wildcards) since ADO, and anyone who has written
passthrough queries has had to address it. Making Jet/ACE SQL more
compatible will be a good thing, as long as there is no sacrifice of
the marvelous little idiosyncracies that it offers that are not
found in all SQL dialects (to list a few, TOP N, TRANSFORM,
DISTINCTROW),