All Forums Database
tdradha 20 posts Joined 08/10
03 May 2012
BTEQ EXPORTING a VALUE to file.

Hello,

 

I am facing some issues with Bteq export/ display the value in the required format.

 

e.g:-  I am trying the below one.

 

.export file = appxsize.txt

 

SELECT (MAX(currentperm)*(HASHAMP()+1)) AS EffUsedSpaceMB

FROM DBC.TableSizeV

WHERE DATABASENAME ='abc'

AND TABLENAME ='xyz'

GROUP BY databasename,tablename;

.export reset

 

I am gettingh the output as

4.94037117731482E 007

 

but I need the out put as  49,403,711.77

What are the .SET commands I missed?

 

I tried with

.SET LARGEDATAMODE

also

.SET RECORDMODE ON

 

nothing helped me.  Any ideas ?

 

 

Ur's Raad
Jim Chapman 449 posts Joined 09/04
03 May 2012

SELECT (MAX(currentperm)*(HASHAMP()+1))
       (FORMAT'--,---,---,---,---,---,--9.99') AS EffUsedSpaceMB ...

Although you say you need 2 decimal places in the output, note that the result will always be a whole number.  Perhaps you intended the result to be in units of megabytes...

SELECT (MAX(currentperm)*(HASHAMP()+1)) / 1000000
       (FORMAT'--,---,---,---,---,---,--9.99') AS EffUsedSpaceMB ...

tdradha 20 posts Joined 08/10
03 May 2012

Thanks Jim....It helped

Ur's
Raad

tdradha 20 posts Joined 08/10
03 May 2012

Jim,  I have one more quick question can we use multiple export statements with in the single BTEQ Script?

 

e.g:-

 

bteq<< EOF

.logon.....

.export file =abc.txt

select query1

.export reset

 

.export file =123.txt

select query 2

.export reset

 

.quit

EOF

can I do this?

 

Ur's
Raad

ulrich 816 posts Joined 09/09
03 May 2012

I am not Jim but yes you can...

export reset is important here.

feel free to donate bitcoin:12kgAUHFUqvG2sQgaRBXFhCwyf9HXdkGud

tdradha 20 posts Joined 08/10
03 May 2012

Thanks ..I tried it worked!

 

Ur's
Raad

S_Banerjee 15 posts Joined 02/09
04 Jun 2012

Someone please tell me what is the exact function of EOF in bteq<< EOF command I tried with and without <<EOF. Without <<EOF my script goes in interactive mode and with <<EOF its running in batch mode.Please explain.

Thanks,

Banerjee

You must sign in to leave a comment.