|
|
Archives of the TeradataForum
Message Posted: Thu, 27 Feb 2003 @ 21:30:26 GMT
Subj: | | Re: WINDDI, QUERYMAN and BTEQ generate different output for the same query |
|
From: | | Geoffrey Rommel |
| When I run the following query thru Queryman and WinDDI i get results as expected, but when I run them in BTEQ, it gives a different
answer. WHY? | |
The results are the same, of course; it's just that the display of the results is different. The underlying columns in
DBC.DatabaseSpace are all defined as FLOAT, so your outputs are floating-point as well. Queryman and WinDDI ignore format clauses; instead,
they have options that tell how many decimal places to display for floating-point numbers (default=0). BTEQ by default displays all
places.
So the real question is: why isn't BTEQ displaying your numbers with the formats that you specified? I believe this is because the
formats are attached to the terms within the case expression, not to the entire expression. If you apply the format to the entire
expression, as shown below, you will get the requested formatting from BTEQ.
SELECT DatabaseName,
(CASE WHEN (Sum(PeakPerm)/NULLIFZERO(Sum(MaxPerm))*100) IS NULL
THEN 0
ELSE (Sum(PeakPerm)/NULLIFZERO(Sum(MaxPerm))*100)
END) (format '999,999,999,999') (TITLE 'Peak Perm//usage (%)') ...
[you probably want 'ZZZ,ZZZ,ZZZ,ZZ9']
| |