Monday, March 12, 2012

FROM { OJ ...

I'm reviewing a SELECT statement written by someone else...
...FROM { OJ PRTSTK S LEFT OUTER JOIN PRTLTSK LQ ON S.STKKEY = LQ.STKKEY }
WHERE S.STKKEY = 1030 GROUP BY S.STKKEY
Can you tell me what the "{ OJ" is for?
First, I've not seen the use of {} in a FROM clause, is it just to make it
more readable?
Second, what is the "OJ" supposed to do? Outer Join'
If I remove 'OJ', QAnalyzer gives me a "[Microsoft][ODBC SQL Server
Driver]Syntax error or access violation"This seems to be an ODBC escape clause. I was at first when looking
at the code. The "{"
got me thinking. Pairs of { and } is something that the ODBC driver is looki
ng for to replace with
something that is specific for a certain vendor syntax. This allow some thin
gs to be specified in a
generic way and the driver translates it into the vendor specific syntax. Th
e "{" is followed by a
string which tells the ODBC driver what it is. I have a feeling that the str
ing "OJ" stands for
"outer join". I did a quick Google search for below and got some hits. You c
an probably get a better
understanding from browsing those hits:
ODBC "{ OJ"
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"mikeb" <mike@.nohostanywhere.com> wrote in message news:ek25FOrnFHA.2916@.TK2MSFTNGP14.phx.g
bl...
> I'm reviewing a SELECT statement written by someone else...
> ...FROM { OJ PRTSTK S LEFT OUTER JOIN PRTLTSK LQ ON S.STKKEY = LQ.STKKEY
} WHERE S.STKKEY = 1030
> GROUP BY S.STKKEY
> Can you tell me what the "{ OJ" is for?
> First, I've not seen the use of {} in a FROM clause, is it just to make it
more readable?
> Second, what is the "OJ" supposed to do? Outer Join'
> If I remove 'OJ', QAnalyzer gives me a "[Microsoft][ODBC SQL Server Driver]Syntax err
or or access
> violation"
>|||The {} bracket notation is an ODBC function call. The ODBC interface will
interpret anything between the brackets and execute it appropriately for the
target data source. These functions exist so that ODBC applications can have
access to a standard set of features and syntax that may not be directly
supported by all data sources.
For SQL Server this is totally redundant since TSQL directly supports the
same outer join syntax.
David Portas
SQL Server MVP
--|||Google for OJSyntax.
AMB
"mikeb" wrote:

> I'm reviewing a SELECT statement written by someone else...
> ...FROM { OJ PRTSTK S LEFT OUTER JOIN PRTLTSK LQ ON S.STKKEY = LQ.STKKEY
}
> WHERE S.STKKEY = 1030 GROUP BY S.STKKEY
> Can you tell me what the "{ OJ" is for?
> First, I've not seen the use of {} in a FROM clause, is it just to make it
> more readable?
> Second, what is the "OJ" supposed to do? Outer Join'
> If I remove 'OJ', QAnalyzer gives me a "[Microsoft][ODBC SQL Server
> Driver]Syntax error or access violation"
>
>|||I wasn't even sure where to start, but you're right, google of 'OJ syntax'
got me an explanation... and how to work it in qa.
http://db.apache.org/derby/docs/10...ce/sqlj235.html
Thx guys, -m
"mikeb" <mike@.nohostanywhere.com> wrote in message
news:ek25FOrnFHA.2916@.TK2MSFTNGP14.phx.gbl...
> I'm reviewing a SELECT statement written by someone else...
> ...FROM { OJ PRTSTK S LEFT OUTER JOIN PRTLTSK LQ ON S.STKKEY =
> LQ.STKKEY } WHERE S.STKKEY = 1030 GROUP BY S.STKKEY
> Can you tell me what the "{ OJ" is for?
> First, I've not seen the use of {} in a FROM clause, is it just to make it
> more readable?
> Second, what is the "OJ" supposed to do? Outer Join'
> If I remove 'OJ', QAnalyzer gives me a "[Microsoft][ODBC SQL Server
> Driver]Syntax error or access violation"
>

No comments:

Post a Comment