Victoria Yudin has some very useful information on the web but, I need a practical script for SQL. Now you can have it too.
cast(case DISTTYPE when 1 THEN 'Cash' WHEN 2 THEN 'Payable' WHEN 3 THEN 'Discount Available' WHEN 4 THEN 'Discount Taken' WHEN 5 THEN 'Finance Charge' WHEN 6 THEN 'Purchase' WHEN 7 THEN 'Trade Disc.' WHEN 8 THEN 'Misc. Charge' WHEN 9 THEN 'Freight' WHEN 10 THEN 'Taxes' WHEN 11 THEN 'Writeoffs' WHEN 12 THEN 'Other' WHEN 13 THEN 'GST Disc' WHEN 14 THEN 'PPS Amount' WHEN 16 THEN 'Round' WHEN 17 THEN 'Realized Gain' WHEN 18 THEN 'Relaized Loss' WHEN 19 THEN 'Due To' WHEN 20 THEN 'Due From' end as nvarchar(50)) as DistributionType Thanks to Victoria Yudin for the source data. https://victoriayudin.com/gp-tables/pm-tables/