Check the date in the XML filename and the corresponding date inside the XML file.
Hello SSIS experts, Good day. I need help in the resolution for the scenario below: 1. I have an XML file named like (XMLFilename)_(Date).xml. 2. I need to check if the Date in the filename above conforms to mmddyyyy format(as the filenames fed in that format). 3. If the format of the date is fine , go to step 4. 4. Check the <Date> </Date> tag in the XML file. Check the value of the date in this tag conforms to the format yyyy-mm-dd. 5. Check if the file date and the date inside the Date tag are same or not. 6. If they are different , I need to execute some other step which does some error logging which are already available. So , I just wanted to know if anyone has any handy method available to check the steps above basically from 1 to 5. Happy to help! Thanks. Regards and good Wishes, Deepak.
May 17th, 2011 5:16am

you can do it with resorting Script task, in a scrip task you can check the Date format in file name, with this c# code line for example: DateTime newDate = DateTime.ParseExact(strValue, "MMddyyyy", System.Globalization.CultureInfo.InvariantCulture);you should put date part of your filename instead of strValue in above script,you will got error if the date format is not correct,so you can continue if there will be no error http://www.rad.pasfu.com
Free Windows Admin Tool Kit Click here and download it now
May 17th, 2011 5:33am

Thanks Reza for this. Well, to check the value in the Date tag, I think I can check it after loading into the temporary staged table which I already have. So here are the steps I could think of : 1. For each file , get the file name. 2. Get the Date from the filename using script task and store it in a variable. 3. Parse the Date of the file name and if there is an error, I can log it with an error. 4. If the date is fine, I load the data from the file into temporary staging area and then compare the date in the staging area to the date retrieved from step 2. 5. At the same time, check the format of the date in the temporary staging area. 6. If the dates are not equal, I log an error else continue further. Happy to help! Thanks. Regards and good Wishes, Deepak.
May 17th, 2011 6:58am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics