JON wrote:
 
> I'm converting some code that works under MS SQL using ADO & 
> VB. I open a
> recordset using statements similar to this:
> strQry = "SELECT A.Fld1, B.Fld2, C.Fld3 FROM (A LEFT JOIN B 
> ON A.A_ID =
> B.B_ID) LEFT JOIN C ON A.A_ID = C.C_ID where A.A_ID = 8329 
> Order by A.A_ID"
> rs.Open strQry, Cn, adOpenStatic, adLockOptimistic
> 
> When I copy this query into SQL Studio to debug it I get an 
> error: "missing
> keyword: SELECT".
> Why is this?
> 
>  I found that if I get rid of the two parenthesis "(" and ")" 
> in the JOIN
> that I no longer get the error and the query works.
> So I guess you can't have parenthesis in JOIN statements. Is 
> this correct?

The parenthesis after the from is not valid.
SAP DB only supports left deep joins so we decide to generally forbid 
parenthesis in the joined table clause.
For more information about joins see:
http://www.sapdb.org/htmhelp/ea/eba4f43e9211d3a98200a0c9449261/frameset.htm

> So now the code looks something like this:
> strQry = "SELECT A.Fld1, B.Fld2, C.Fld3  FROM A LEFT JOIN B 
> ON A.A_ID =
> B.B_ID LEFT JOIN C ON A.A_ID = C.C_ID where A.A_ID = 8329 
> Order by A.A_ID"
> rs.Open strQry, Cn, adOpenStatic, adLockOptimistic
> 
> But now I get a general error "updates to this table is not allowed".
> Why is this? and what would you suggest I do about it?

For some cursor model within ODBC the SAP DB odbc driver add a for update 
clause to the statement. But this clause is not allowed for join selects.
So if you change your cursor model this error may disappear.
I think you will find more details on the mailing list.
Try "odbc update allowed" as search expression on 
http://groups.yahoo.com/group/sapdb-general/
because the sapdb.org search engine seems to be out of order.

HTH.

Kind regards,
Holger
SAP Labs Berlin 
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to