|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Comparing 2 filesDear All,
Periodically, i need to copy a file from the source folder to destination folder. the source file will be updated from time to time. Before copying the file to destination folder, i need to compare the modified date of the file, mean only copy the file to destination folder if the source file is updated. How can we do this in SQL? I will use the xp_cmdShell to copy the file. If use the xp_getfiledetails, how can i get the information return fromt the stored procedure to check the modified date? Or, is there any better method of doing this? I am using SQL Server 2000. Thanks & Best Regards, Edward Insert as below..and then you can compare ..
CREATE TABLE #FILE ( name varchar(30) null, size int null, creationdate int null, creationtime int null, lastwrittendate int null, lastwrittentime int null, lastaccesseddate int null, lastaccessedtime int null, attributes int null ) INSERT #FILE EXEC master..xp_getfiledetails @FILE_NAME MJKulangara http://sqladventures.blogspot.com Hi
You could do the file copy and comparison using a DTS package and an ActiveX script. See http://www.sqldts.com/default.aspx?292 John Show quote "Edward Low" <wc_***@hotmail.com> wrote in message news:eRZ8g9qLGHA.3936@TK2MSFTNGP12.phx.gbl... > Dear All, > > Periodically, i need to copy a file from the source folder to destination > folder. the source file will be updated from time to time. Before copying > the file to destination folder, i need to compare the modified date of the > file, mean only copy the file to destination folder if the source file is > updated. How can we do this in SQL? > > I will use the xp_cmdShell to copy the file. If use the xp_getfiledetails, > how can i get the information return fromt the stored procedure to check > the modified date? Or, is there any better method of doing this? > > I am using SQL Server 2000. > > Thanks & Best Regards, > > > Edward > |
|||||||||||||||||||||||