Line Breaks in the value ignored while writing to output file -Linux-BTEQ

Database

Line Breaks in the value ignored while writing to output file -Linux-BTEQ

Hi All,

 

I have setup a process that searches SQL queries executed by the users from the Teradata querylog and then save them in a different table. The process then executes these SQLs one after the other from the table and loads the result into a target table. The Users will create SQLs thru SQL Assistant or other tools and they may have line breaks in them. These line breaks are also actually stored in the Querylog and the tabl;e where i am saving the SQL. But, when I am writing the SQL to a file to submit to Teradata thru BTEQ, these line breaks are ignored. The SQL still executes fine. But, the problem comes when there is a single line comments in the middle of the SQL which is causing the rest of the SQL to be ignored and that is happening as the line breaks are ignored when I am writing the SQL to the file. 

 

Actual Query :

-------- -------

Select Cust_id

          , Cust_name 

          , Cust_city

From Customer 

-- Limit by joing date

where cust_join_dt > 'MM/DD/YYY'  ;

 

Query written to file:

-------- --------- -- ----

Select Cust_id          , Cust_name           , Cust_city From Customer -- Limit by joing date where cust_join_dt > 'MM/DD/YYY'  ;

 

The where clause is ignored and the result is being impacted or the query may fail in other cases. 

 

My environment is Linux, Teradata 16.10 

 

Thanks,

Vijay

 

1 REPLY
Teradata Employee

Re: Line Breaks in the value ignored while writing to output file -Linux-BTEQ

How are you extracting the SQL, perhaps EXPORT REPORT in BTEQ? If so, BTEQ 16.10 introduced the .SET TranslateCtrlsToSpaces OFF directive to modify this behavior.