Hi Guys,
Don't know how to use a trim function in the following case.
--Need to run daily an append query, which would check the table on a server (dbo_FCST_TISSUE_RECON.SERIAL_ID) against our local table (Counts)and find the items we've missed to count.
--Everything works perfectly, except for items that are differently formatted. We are using XXXXXX-XXX-XXX format in our databases; however our customers using just numbers without dashes.
Here the code, that I've been using before found this problem:
Thank you in advance!
Valeriya
Thank You,
Don't know how to use a trim function in the following case.
--Need to run daily an append query, which would check the table on a server (dbo_FCST_TISSUE_RECON.SERIAL_ID) against our local table (Counts)and find the items we've missed to count.
--Everything works perfectly, except for items that are differently formatted. We are using XXXXXX-XXX-XXX format in our databases; however our customers using just numbers without dashes.
Here the code, that I've been using before found this problem:
Code:
[b]INSERT INTO[/b] Counts ( Cust, [Month/Yr], TID, [Update Date] )
[b]SELECT[/b] [0001 Bin Detail].Cust, IIf(IsNull([counts].[month/yr]),DateSerial(Year(Date()),Month(Date()),8)," ") AS [Month/Yr], dbo_FCST_TISSUE_RECON.SERIAL_ID AS TID, Date() AS [Update Date]
[b]FROM[/b] (dbo_FCST_TISSUE_RECON LEFT JOIN [0001 Bin Detail] ON dbo_FCST_TISSUE_RECON.SERIAL_ID = [0001 Bin Detail].TID) LEFT JOIN Counts ON dbo_FCST_TISSUE_RECON.SERIAL_ID = Counts.TID
[b]GROUP BY[/b] [0001 Bin Detail].Cust, IIf(IsNull([counts].[month/yr]),DateSerial(Year(Date()),Month(Date()),8)," "), dbo_FCST_TISSUE_RECON.SERIAL_ID, Date(), Counts.TID
[b]HAVING[/b] ((([0001 Bin Detail].Cust) Is Not Null) AND [COLOR=purple][b]((Counts.TID) Is Null)<---Here where the verification takes palce,append only items that are not in a Counts table[/b][/color] AND ((Max(dbo_FCST_TISSUE_RECON.SCAN_DT))>DateSerial(Year(Date()),Month(Date()),0)));
Thank you in advance!
Valeriya
Thank You,