SELECT tmp.eai_lineNumber, tmp.sku_sku, tmp.sku_skuid, tmp.custom_1, tmp.custom_2, tmp.custom_3, tmp.custom_4, tmp.custom_5, tmp.custom_6, tmp.custom_10, custom_12, custom_13, opr.companyname, custom_14, 'Operator' as RecordType FROM tbl_IMPORT_ProductData tmp INNER JOIN tbl_OPR_ClientOperators opr ON CAST(tmp.custom_10 AS int) = opr.operatorid AND tmp.custom_2 IN ('OPR','CHO') WHERE tmp.eai_batchid = UNION SELECT tmp.eai_lineNumber, tmp.sku_sku, tmp.sku_skuid, tmp.custom_1, tmp.custom_2, tmp.custom_3, tmp.custom_4, tmp.custom_5, tmp.custom_6, tmp.custom_10, custom_12, custom_13, dst.cdr_dstName companyname, custom_14, 'Distributor' as RecordType FROM tbl_IMPORT_ProductData tmp INNER JOIN tbl_CDR_Distributors dst ON CAST(tmp.custom_10 AS int) = dst.cdr_recordid AND rtrim(tmp.custom_2) IN ('CDR','DST','PDST') WHERE tmp.eai_batchid = UNION SELECT tmp.eai_lineNumber, tmp.sku_sku, tmp.sku_skuid, tmp.custom_1, tmp.custom_2, tmp.custom_3, tmp.custom_4, tmp.custom_5, tmp.custom_6, tmp.custom_10, custom_12, custom_13, '' as companyname, custom_14, 'UNMAPPED' as RecordType FROM tbl_IMPORT_ProductData tmp WHERE tmp.eai_batchid = AND custom_10 IS NULL select custom_2 customerType, custom_3 customerId, custom_4 customerName, count(*) lineCount, min( eai_lineNumber ) firstLine from tbl_IMPORT_ProductData where eai_batchId = and custom_10 is null group by custom_2, custom_3, custom_4 order by firstLine select sku_sku, sku_skuDesc, count(*) lineCount, min( eai_lineNumber ) firstLine from tbl_IMPORT_ProductData where eai_batchId = and sku_skuId is null group by sku_sku, sku_skuDesc order by firstLine SELECT eai_lineNumber FROM qry_getdata WHERE custom_14 = 'UPDATED' SELECT eai_lineNumber FROM qry_getdata WHERE custom_14 = 'ADDED' SELECT eai_lineNumber FROM qry_getdata WHERE custom_14 = 'SKIPPED' OR custom_12 = 'Invalid' SELECT * FROM qry_getdata WHERE custom_12 = 'Invalid' ORDER BY custom_13, companyname SELECT * FROM qry_getdata WHERE custom_14 = 'ADDED' ORDER BY custom_13, companyname SELECT * FROM qry_getdata WHERE custom_14 = 'UPDATED' ORDER BY custom_13, companyname SELECT * FROM qry_getdata WHERE custom_14 = 'SKIPPED' ORDER BY custom_13, companyname
SPECIFIED SKU SUMMARY
Message Detail
BatchID #qmd_batch.batchid#
Batch Date #dateformat(qmd_batch.batchtime,"mm-dd-yyyy")# #timeformat(qmd_batch.batchtime,"hh:mm tt")#
Client Name #variables.ClientName#
Total Rows Processed #numberformat(val(qry_getdata.recordCount))#
Rows Added #numberformat(val(qofq_Added.recordCount))#
Rows Updated #numberformat(val(qofq_Inserted.recordCount))#
Rows Skipped #numberformat(val(qofq_Skipped.recordCount))#

Unknown Customers
CustomerType CustomerId CustomerName Lines First Line
#htmleditformat( customerType )# #htmleditformat( customerId )# #htmleditformat( customerName )# #lsnumberformat( lineCount )# #lsnumberformat( firstLine )#

Some customers where not found by customerName. Below are a list of possible distributor names.

select cdr.cdr_dstName, dst.dstName from tbl_CDR_Distributors cdr left outer join tbl_DST_Distributors dst on dst.dstId = cdr.fsl_dstid where cdr.cdr_dstCompanyType = 'P' and cdr.ownerId = and cdr.fsl_tablecode = order by cdr.cdr_dstName
Possible Parent Distributors
Distributor NameFSLibrary Name
#htmleditformat( cdr_dstName )# #htmleditformat( dstName )#&##160;

select distinct rtrim( left( custom_4, 3 )) partialName from tbl_IMPORT_ProductData where eai_batchId = and custom_10 is null and custom_2 in ( 'DST' ) and nullif( custom_4, '' ) is not null select cdr.cdr_dstName, dst.dstName from tbl_CDR_Distributors cdr left outer join tbl_DST_Distributors dst on dst.dstId = cdr.fsl_dstid where cdr.cdr_dstCompanyType = 'B' and cdr.ownerId = and cdr.fsl_tablecode = and ( 1 = 2 or cdr.cdr_dstName like ) and ( dst.dstId is null or nullif( dst.dstParentCo, 0 ) is null ) order by cdr.cdr_dstName
Possible Independent Distributors
Distributor NameFSLibrary Name
#htmleditformat( cdr_dstName )# #htmleditformat( dstName )#&##160;

Note: The FSLibrary Name when present may be used instead of the Distributor Name.

Unknown SKUs
Sku SkuDescription Lines First Line
#htmleditformat( sku_sku )# #htmleditformat( sku_skuDesc )# #lsnumberformat( lineCount )# #lsnumberformat( firstLine )#

EXCEPTIONS
MFR Sku Customer Sku Customer Type Customer ID Distributor/Operator Error
#qofq_Exceptions.sku_sku# #qofq_Exceptions.custom_1# #qofq_Exceptions.custom_2# #qofq_Exceptions.custom_3# #qofq_Exceptions.companyname# #qofq_Exceptions.custom_13#
None

ADDITIONS
MFR Sku Customer Sku Customer Type Customer ID Operator Action
#qofq_InsertedSum.sku_sku# #qofq_InsertedSum.custom_1# #qofq_InsertedSum.custom_2# #qofq_InsertedSum.custom_3# #qofq_InsertedSum.companyname# #qofq_InsertedSum.custom_14#
None

UPDATES
MFR Sku Customer Sku Customer Type Customer ID Distributor/Operator Action
#qofq_UpdatedSum.sku_sku# #qofq_UpdatedSum.custom_1# #qofq_UpdatedSum.custom_2# #qofq_UpdatedSum.custom_3# #qofq_UpdatedSum.companyname# #qofq_UpdatedSum.custom_14#
None
SKIPPED ROWS
MFR Sku Customer Sku Customer Type Customer ID Distributor/Operator Action
#qofq_SkippedSum.sku_sku# #qofq_SkippedSum.custom_1# #qofq_skippedSum.custom_2# #qofq_SkippedSum.custom_3# #qofq_SkippedSum.companyname# #qofq_SkippedSum.custom_14#
None