All Forums Tools
ursgovi 8 posts Joined 04/12
06 Sep 2012
BTEQ REPORT

Hi,

I'm using the following code to create a report.

<LOGON COMMAND>

.EXPORT REPORT FILE=MY_FILE.TXT

SELECT COLUMN1,COLUMN2,COUNT(*) FROM MY_TABLE;

<LOGOFF COMMAND>
 

I'm getting the output as follows:

COLUMN1      COLUMN2      COUNT(*)

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

col1a              col2a             100
col1b              col2b             200
col1c              col2c              150

 

But, I'm expecting my report to include my actual query and not to display the columns names as title.  Below is the sample.

 

SELECT COLUMN1,COLUMN2,COUNT(*) FROM MY_TABLE;

col1a              col2a             100
col1b              col2b             200
col1c              col2c              150

 

Please assist.  Thanks in advance.

 

Govi

anjanpaul 6 posts Joined 12/10
10 Sep 2012

use following command in your bteq script:

.SET FORMAT OFF;

.SET TITLEDASHES OFF;

ursgovi 8 posts Joined 04/12
10 Sep 2012

@anjanpaul:

I've tried these included but my purpose is not served.

 

.SET FORMAT OFF;  --i'm already using this.  Sorry that I missed to mention.

 

.SET TITLEDASHES OFF;

this helped me to have the dashes removed but not the title.  I added (TITLE '') to the end of my query to get the title removed and that worked.

 

Now, my report is in shape except for one, the query itself. 

 

ulrich 816 posts Joined 09/09
10 Sep 2012

There is not possibilty to get this automated.

you would need to do it manually

 

select 'select what_ever from tab order by 2,3,5' (title'');

Be carefull with in query ' which would need to be replaced with ''.

Alternative create a small Java function to write the SQL into a file and export the data into the same file. Should be easier to achive what you want fully automated.

feel free to donate bitcoin:12kgAUHFUqvG2sQgaRBXFhCwyf9HXdkGud

Qaisar Kiani 337 posts Joined 11/05
10 Sep 2012

SELECT 'SELECT COLUMN1,COLUMN2,COUNT(*) FROM MY_TABLE;' (TITLE '');

SELECT COLUMN1 (TITLE '')

, COLUMN2 (TITLE '')

, COLUMN3 (TITLE '')

FROM MY_TABLE;

 

Outputing the actual SQL will be a manual process as the query needs to be hardcoded.

You can get rid of the column names by using the empty title.

You must sign in to leave a comment.