l've created a SQl dts package and embedded the code in the attached file. l'm inserting into a stage table. l would like to add a few more things in my logic but its just not working..Please assist.
Addition 1: Where DDT316 > today's date
l can do it outside open query but it runs long
Addition 2 :- Calculate age in the select based on field
Datediff(yy,('19' + Substring(a.CleanSAID,1,6)),Getdate())
l want it inside open qry
Addition 3 : l'm doing an update outside open qry to close the open periods..l also want to do it within open qry.
UPDATE tbStageLeadsMaster
SET Clp316 = 'C'
WHERE DDT316 < dbo.fn_formatDate(Getdate(),'yyyymmdd')
AND Clp316 NOT IN ('R','S','C')