![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a situation where I'm loading text files into a database. Filenames are reused, so two files with the same name might hold different data. I need to be able to uniquely identify files using a method other than filename so that I know if I've loaded the file already or not. One thought was to generate a hash key for each file, but I don't know if that's possible in DTS/TSQL. Any suggestions? |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
I have a situation where I'm loading text files into a database. Filenames are reused, so two files with the same name might hold different data. I need to be able to uniquely identify files using a method other than filename so that I know if I've loaded the file already or not. One thought was to generate a hash key for each file, but I don't know if that's possible in DTS/TSQL. Any suggestions? |
#5
| |||
| |||
|
|
The latter won't work because what if the source accidentally sends the same file twice? It would get loaded twice since the original has already been renamed/moved. FYI, since I posted this question, I came across an Extended Stored Proc MD5 implementation. You can check it out here: http://www.thecodeproject.com/databa...orumid=32460&e xp=0&select=1054259 |
#6
| |||
| |||
|
|
In message <4D042BE8-E162-4DBF-90A5-494A0E06D7FD (AT) microsoft (DOT) com>, DavidStallard <DavidStallard (AT) discussions (DOT) microsoft.com> writes The latter won't work because what if the source accidentally sends the same file twice? It would get loaded twice since the original has already been renamed/moved. FYI, since I posted this question, I came across an Extended Stored Proc MD5 implementation. You can check it out here: http://www.thecodeproject.com/databa...orumid=32460&e xp=0&select=1054259 You said the filename was reused, not the file itself was reused or rather resent. Isn't this a bit stupid on the part of the file supplier? Why not tackle that? Either way I wouldn't use an xp, partly because unless they are 100% perfect they could destabilise your SQL Server, and also transferring the entire file into SQL to do the hash seems excessive. Try some of these articles on file CRCs, seems more appropriate since you start with a file- File Verification Using CRC (http://www.dogma.net/markn/articles/crcman/crcman.htm) 32 Bit CRC File Calculation (http://www.createwindow.com/programm...32/crcfile.htm) FSUM - File Integrity Checker (http://www.slavasoft.com/fsum/) Free Download Command Line SFV Checker 0.1 - Generates and checks the integrity of a SFV. (http://www.vadino.com/windows/utilit...sfv-checker.ht ml) MD5: Command Line Message Digest Utility (http://www.fourmilab.ch/md5/) -- Darren Green (SQL Server MVP) DTS - http://www.sqldts.com PASS - the definitive, global community for SQL Server professionals http://www.sqlpass.org |
![]() |
| Thread Tools | |
| Display Modes | |
| |