December 28, 2009 at 10:18 am
I have a process in SSIS where I insert data into a table. The data is coming from a Flat File. I insert the File Name into a Log table to track what files have been processed.
When I re-process the Flat Files I need to know if the file exists and if exists I need to know if they have changed in its content. I can control in my process If the files exist. But I don’t know how to compare if the file’s contest has changed since last time I insert it.
When I insert the File Name into my Log Table I created a Hash for the File like this:
(upper(SUBSTRING(master.dbo.fn_varbintohexstr(HashBytes('MD5', " + "'" + @[User::FileName] + "'" + ")), 3, 32)))
I read all the articles about the Checksum or Hash, but I don’t know how to apply it. I’m not sure if I’m doing the right computation of content between files.
Any advice will be appreciated!
Regards,
December 28, 2009 at 12:38 pm
not body ?
December 30, 2009 at 5:51 am
simple answer is to store the OS system filedate when you load the file. then just compare the filedate with the file to see if different. I note there are ways to modify/replace a file without modifying that date, but that is an exception not the rule.
you could also use a vb script execution to compute a checksum of the contents of the file and store that value and compare to existing file to see if different. I note again that 2 different files have a VERY small chance of computing the same checksum.
Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service
December 30, 2009 at 8:34 am
Thank you
I tried the checksum, but it didnt detect the differences. I was even forcing changes in the files and I got always the same CheckSum.
Im controling my process differently now.
Thank you tho
Happy New Year !! 😀
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply