Only an ET or null statement is legal after a DDL Statement

Connectivity

Only an ET or null statement is legal after a DDL Statement

I am working on a Narrow Cast Server project in Microstrategy; teradata is the database. We have configured an ODBC connection to connect the NCS to teradata.

I get an ODBC error while trying to execute a multi pass sql using the ODBC connection. However, a simple query runs fine.  

The complete error is " Database Classes][Error] Execute Query failed. Error type: Odbc error. Odbc operation attempted: SQLExecDirect. [25000:-3932: on SQLHANDLE] [Teradata][ODBC Teradata Driver][Teradata Database] Only an ET or null statement is legal after a DDL Statement."

The sample sql is as belows:

=============================================

SET QUERY_BAND = 'Project=Example2;Report=0315-17.11;MSTRUser=MSTRPORTAL_EXXXX;' FOR SESSION;

select * from table1;

SET QUERY_BAND = NONE FOR SESSION;

=============================================

The SQL executes fine when run directly against the database using SQL Assistant. 

I have discussion on this topic on many forums but haven't found any concrete solution. Below are the things I have tried:

1) I have tried explicitly using placing End Transaction followed Begin Transaction after the first pass. Actually have tried placing BT and ET at various points in the multi pass SQL without any luck.

2) Tried placing a null statement by including a blank ;

3) On the ODBC configuration, I have tried setting the Sesion mode to Teradata.

I have contacted Microstrategy support but havent had any resolution yet. One of their solution suggested its a teradata issue so here I am.

Any suggestions? This has been a tough one to crack. Will greatly appreciate any assitance

2 REPLIES
Senior Supporter

Re: Only an ET or null statement is legal after a DDL Statement

As you wanne use the query band setting only for the one sql try

BT;

SET QUERY_BAND = 'Project=Example2;Report=0315-17.11;MSTRUser=MSTRPORTAL_EXXXX;' FOR transaction;

select * from table1;

ET;

 

at least it worked for me in V2R14

 

Ulrich

Teradata Employee

Re: Only an ET or null statement is legal after a DDL Statement

You wrote: "The SQL executes fine when run directly against the database using SQL Assistant."

Try "Execute Parallel" (vs. "Execute") in SQL Assistant. 

"Execute Parallel" will fail in SQL Assistant. "Execute Parallel" sends one Multi-Statement request to the Teradata Database; while "Execute" sends three single-statement requests.