dbTalk Databases Forums  

Heads Up on SQL92 Mode

comp.databases.ms-access comp.databases.ms-access


Discuss Heads Up on SQL92 Mode in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
David-W-Fenton
 
Posts: n/a

Default Heads Up on SQL92 Mode - 11-05-2010 , 03:35 PM






If you're like me (a long-time Access developer who doesn't do
ADPs), you've basically ignored SQL92 Mode in Access. If you're
unaware of its existence, what it does is enable a certain level of
compatibility with SQL Server's SQL dialect. Chief among those are:

1. use of % and _ as wildcards (instead of conventional Access * and
?)

2. execution of certain kinds of SQL commands (chiefly generic DDL)
that can't be run directly in Access (i.e., in the QBE as opposed to
via ADO in code).

If you don't do ADPs, you don't necessarily need to write SQL
Server-compatible SQL, so this is not much of an issue for you. And
if you use Access the way I do, you don't often have a need to
execute generic DDL statements (indeed, if you're like me, you
almost never do so at all!).

Anyway, that's the background.

I'm posting this to warn others off trying to use it without
thinking it through very carefully.

I accidentally released to users a version of their app that had
SQL92 mode turned on. I had been testing out some things that
required SQL92 mode, and I generally use my existing projects (since
I understand how they work better than if I used an old app or some
generic app). Normally, I immediately change any settings back to
the original when I'm done with testing, but for some reason, that
didn't happen in this case, and I ended up shipping an update with
SQL92 mode turned on.

Most of it worked.

Indeed, one of the things it does is convert all LIKE comparisons in
stored SQL statements (stored QueryDefs, recordsources and
rowsources) that use traditional Access wildcards to use ALIKE
(which allows you to use the opposite mode's wildcards; e.g., if
you're in SQL 89, you can use ALIKE "this%", or if in SQL 92, you
can use ALIKE "this*").

Unfortunately, it causes many problems that that substitution does
not fix:

1. greatly increased sensitivity to aliases and syntax. At first I
though I had used a reserved word with a field called "Current" but
that's not a reserved word in Access. I was only able to make the
SQL work by surrounding all occurrences of "Current" with square
brackets:

SELECT tluTaxRates.TaxRate, Format([TaxRate],"0.0000%")
& '-'+[TaxRateDescription] AS Rate,
Format([tluTaxRates].[Current],"Yes/No") AS [Current]
FROM tluTaxRates
ORDER BY tluTaxRates.[Current], tluTaxRates.TaxRate;

The original version of this lacked any brackets around "Current"
and works just fine in SQL 89 mode, but with SQL 92 turned on, the
brackets were the only way to make it work because "Current" is a
reserved word in the SQL 92 standard.

Thus, switching to SQL 92 means you have a different set of reserved
words to contend with.

2. it can cause AutoComplete in dropdown lists to stop working. I
had a terrible time with this one -- I had a dropdown list with 3
columns, the first and last not displayed, and AutoComplete wouldn't
work, so typing was completely ineffective in editing the dropdown
list. Now, I had another very similar dropdown on the same form, but
with only two columns (the second hidden). Both used ALIKE for a
comparison, so I puzzled for a long time over what the difference
was. As it turned out, it was that the first column was the bound
column and it wasn't hidden.

So, I'm not certain on this, but it seems that switching to SQL 92
broke combo boxes where the first visible column was not the bound
column.

There were also strange reports of other things that we never
figured out, and that have disappeared once SQL 92 mode was turned
off (so far as I can tell), but I didn't waste time on those trying
to figure out what was going on, so I won't discuss those in detail.

The takeaway:

Don't use SQL 92 mode unless you have a compelling reason to do so
and are prepared to convert all your SQL to be fully compatible with
a non-Access SQL standard.

Keep in mind that ADO uses SQL 92 by default (so I presume you'd
have reserved word problems in ADO, which is another reason to avoid
it, in my opinion -- a generic database interface should inherit the
foibles of each particular database it's connecting to, not
introduced a set of its own, independent of any db engine).

Also keep in mind that DAO is SQL 89 no matter what -- there is no
way to get SQL 92 mode with it, even if your database is set to use
SQL 92 mode.

Since there's very little reason to use ADO in Access MDBs/ACCDBs, I
think there's almost no justification to turn on SQL 92 mode.

You've been warned!

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #2  
Old   
Tony Toews
 
Posts: n/a

Default Re: Heads Up on SQL92 Mode - 11-07-2010 , 03:04 PM






On 5 Nov 2010 21:35:46 GMT, "David-W-Fenton"
<NoEmail (AT) SeeSignature (DOT) invalid> wrote:

Quote:
Since there's very little reason to use ADO in Access MDBs/ACCDBs, I
think there's almost no justification to turn on SQL 92 mode.
A client likes ADO when connected to a SQL Server database. There are
more "things" that you can do easier, or maybe even at all, compared
to DAO. Trouble is I don't recall what they are right now.

They do run a lot of stored procedures which return recordsets to the
bound forms. Again not sure why.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/

Reply With Quote
  #3  
Old   
David-W-Fenton
 
Posts: n/a

Default Re: Heads Up on SQL92 Mode - 11-07-2010 , 07:00 PM



Tony Toews <ttoews (AT) telusplanet (DOT) net> wrote in
news:fo4ed6h3blf7rbat4u22m0i084m2cvm6ej (AT) 4ax (DOT) com:

Quote:
On 5 Nov 2010 21:35:46 GMT, "David-W-Fenton"
NoEmail (AT) SeeSignature (DOT) invalid> wrote:

Since there's very little reason to use ADO in Access MDBs/ACCDBs,
I think there's almost no justification to turn on SQL 92 mode.

A client likes ADO when connected to a SQL Server database. There
are more "things" that you can do easier, or maybe even at all,
compared to DAO. Trouble is I don't recall what they are right
now.

They do run a lot of stored procedures which return recordsets to
the bound forms. Again not sure why.
Well, that oughtn't be an issue, since you're not connecting to
Jet/ACE. But who knows!

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #4  
Old   
David-W-Fenton
 
Posts: n/a

Default Re: Heads Up on SQL92 Mode - 11-07-2010 , 07:01 PM



"David-W-Fenton" <NoEmail (AT) SeeSignature (DOT) invalid> wrote in
news:Xns9E27B2FFFA473f99a49ed1d0c49c5bbb2 (AT) 74 (DOT) 209.136.91:

Quote:
Indeed, one of the things it does is convert all LIKE comparisons
in stored SQL statements (stored QueryDefs, recordsources and
rowsources) that use traditional Access wildcards to use ALIKE
(which allows you to use the opposite mode's wildcards; e.g., if
you're in SQL 89, you can use ALIKE "this%", or if in SQL 92, you
can use ALIKE "this*").
This statement was in error as written. It actually changes your
LIKE "this*" to ALIKE "this%", not retaining the SQL 89 wildcards,
as is implied by the text above.

--
David W. Fenton http://www.dfenton.com/
contact via website only http://www.dfenton.com/DFA/

Reply With Quote
  #5  
Old   
Bob Barrows
 
Posts: n/a

Default Re: Heads Up on SQL92 Mode - 11-07-2010 , 07:32 PM



Tony Toews wrote:
Quote:
On 5 Nov 2010 21:35:46 GMT, "David-W-Fenton"
NoEmail (AT) SeeSignature (DOT) invalid> wrote:

Since there's very little reason to use ADO in Access MDBs/ACCDBs, I
think there's almost no justification to turn on SQL 92 mode.

A client likes ADO when connected to a SQL Server database. There are
more "things" that you can do easier, or maybe even at all, compared
to DAO. Trouble is I don't recall what they are right now.

Disconnected recordsets are the biggest benefit. Other than that, I see no
reas on to prefer DAO when using Access as the front end/

Reply With Quote
  #6  
Old   
Tony Toews
 
Posts: n/a

Default Re: Heads Up on SQL92 Mode - 11-13-2010 , 04:35 PM



On Sun, 7 Nov 2010 20:32:37 -0500, "Bob Barrows"
<reb01501 (AT) NOSPAMyahoo (DOT) com> wrote:

Quote:
Since there's very little reason to use ADO in Access MDBs/ACCDBs, I
think there's almost no justification to turn on SQL 92 mode.

A client likes ADO when connected to a SQL Server database. There are
more "things" that you can do easier, or maybe even at all, compared
to DAO. Trouble is I don't recall what they are right now.

Disconnected recordsets are the biggest benefit. Other than that, I see no
reas on to prefer DAO when using Access as the front end/
No, they're not using disconnected recordsets. I think it was that
you could call a stored procedure and get a recordset returned.

Tony

--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/

Reply With Quote
  #7  
Old   
TechVsLife
 
Posts: n/a

Default Re: Heads Up on SQL92 Mode - 11-25-2010 , 06:41 PM



Quote:
No, they're not using disconnected recordsets. * I think it was that
you could call a stored procedure and get a recordset returned. *
But DAO also fully supports returning recordsets from stored
procedures.

Reply With Quote
  #8  
Old   
TechVsLife
 
Posts: n/a

Default Re: Heads Up on SQL92 Mode - 11-25-2010 , 08:18 PM



The only DAO limitation I've come across so far is lack of any support
for getting output parameters and the return code of stored
procedures. Output by recordsets is preferable anyway I think (and
DAO can also get the resultsets from sql server table functions, as
well as multi-recordset returns from stored procedures).

Reply With Quote
  #9  
Old   
TechVsLife
 
Posts: n/a

Default Re: Heads Up on SQL92 Mode - 11-26-2010 , 12:12 AM



Correction: one can also get the output parameters and return code
back in DAO (with the right t-sql text in the pass through query), so
everything is covered.

Reply With Quote
  #10  
Old   
Tony Toews
 
Posts: n/a

Default Re: Heads Up on SQL92 Mode - 11-26-2010 , 06:52 PM



On Thu, 25 Nov 2010 16:41:55 -0800 (PST), TechVsLife
<techvslife (AT) gmail (DOT) com> wrote:

Quote:
No, they're not using disconnected recordsets. * I think it was that
you could call a stored procedure and get a recordset returned. *

But DAO also fully supports returning recordsets from stored
procedures.
Ah, I stand corrected. I doubt that was why then.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.