wsilage
Yak Posting Veteran
82 Posts |
Posted - 2013-03-18 : 08:37:35
|
I need some advice. Below is a store procedure that needs to run twice a day, but the output file cannot have the same records in it as the previous time it would run.At first they just wanted daily so I added a get date in there, but now they want it twice a day. My getdate seems to keep putting the same claim on both reports and I don't want that.What can I do to have this pull correctly?Insert INTO TCN.DBO.TCN_CITY_Savannah (clm_id1, Date, clm_5, clm_65a, clm_clir, clm_rcvd, clm_6a, clm_6b, clm_tchg, clm_nego, clm_sppo, clm_form, clm_att1, clm_att2, clm_att3, clm_att4, clm_att5, clm_chast, clm_stades, clm_snto, clm_adjto)SELECT DISTINCT clm_id1, CONVERT(date, GETDATE())as Date, clm_5, clm_65a, clm_clir, clm_rcvd, clm_6a, clm_6b, clm_tchg, clm_nego, clm_sppo, clm_form, clm_att1, clm_att2, clm_att3, clm_att4, clm_att5, clm_chast, clm_stades, clm_snto, clm_adjtoFROM impact.dbo.clmWHERE (clm_clir = 3504) AND (clm_snto = 'TCN') AND (clm_6b >= '01/01/2013') and clm_stades in ('DONE','COMP','BACK')and Clm_id1 not in (Select clm_id1 from TCN.DBO.TCN_CITY_Savannah) Select Distinct* from TCN.DBO.TCN_CITY_Savannah Where Date = CONVERT(date, GETDATE()) |
|