Cescok75
Cescok75

Reputation: 1

Extract query text in Teradata , from dbc.dbqlsqltbl

I'm trying to extract a query text from dbc.dbqlsqltbl. My goal is to extract the query text using export file in bteq , and then execute the query using run file.

for example:

.export report file = filename.sql
select sqltextinfo from dbc.dbqlsqltbl where queryid = \<number\>
.export reset
.run file = filename.sql

The query text is stored in the field sqltextinfo as a single row, and in some cases it generates some difficulties.

For example if the original query is

select field1, field2 --some comment
from table1;

in filename.sql I will find

select field1, field2 --some comment from table1;

The "run file" generates the execution error :

Failed [3822 : 42S22] Cannot resolve column 'field1'. Specify table or view.

Is it possible to extract the query with the rigth "wrap text" ?

Upvotes: 0

Views: 70

Answers (0)

Related Questions