Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

Data From Vendor Changes - response (3) by TDW

$
0
0

My apologies for not responding sooner. I have not receiving emails when a member comments on my posts. Also, I apologize for the cryptic nature of my question and sample data. I work in a highly confidential area and I was trying to sanitize my code and still make it understandable.
Since posting the above, we discovered one of our former programmers had found a way around this issue. However, before I display the change, additional explanation, though still somewhat cryptic, is in order.
The process.
We receive a flat file containing hundreds of columns for a single customer record. The columns are paired off with a code number and value. Prod1N and Value1V....Prod100N and Value100V. I will use Prod1N & Value1V through Prod5N & Value5V for this example.
A customer might have only ordered tank tops (1N & 1V) and sportsocks (5N & 5V); however, the 2N...4V cols would still be poplulated with NULL's. In order to process the customer each col pair would be read in using the convulted coding in the original post. However, this former programmer wrote another BTQ to be run prior which reduced the decreased the number of cols but increased the number of records, making the coding more efficient.
This code...
insert into tCustProd
SELECT  HeaderField, Field1N, Field1V
from tCustProd where Field1V <> ''
UNION
SELECT HeaderField, Field2N, Field2V
from tCustProd where Field2V <> ''
UNION

etc....
produced this table...
CustID   Prod1   Value1  
C123     0010     10
C123     0035      5
C123     0085     99
C123     0245      3
C123     0900     14
C456     0035     75
C456     0085     42
C456     0900      6
 
Now in the second (original BTQ) I run this coding instead
max(case when Prod1N = 0010 then Value1V end)
 as TankTops,
max(case when Prod1N = 0020 then Value1V end)
 as DressShoes,
max(case when Prod1N = 0030 then Value1V end)
 as BollaHats,
max(case when Prod1N = 0035 then Value1V end)
 as CommandoBoots,
max(case when Prod1N = 0040 then Value1V end)
 as SportsSocks,

because there are only 3 cols (CustID, Prod1, Value1) in the new table.
Again, I apologize for being so cryptic. But I wanted to respond and not appear ungrateful for the help you were providing. I am certain I will need more assistance in the future.
Thanks and God Bless,
Genesius


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>