retrieve a filesystem's date and time from TSQL

  • Has anyone ever done this?

    I've got a backup file which is copied over to a share on my sql 2000 server from our corporate office. I have script in place which will restore this into my server so that all of the data is accessible locally.

    What I want to do is be able to read the date and time the file contains from the filesystem and check it against criteria in order to restore the backup more smoothly. As it sits now, someone calls me, and says the file is copied, and then i execute the script manually.

    Also, is there a way that TSQL can check if a file is currently in use by the filesystem?

    thanks.

  • You can script it outside SQL also, but just another thought -- look into log shipping. Then the file can be restored automatically from only the changes being sent over. Do the restores in off hours.

  • The restore isnt the problem, the issue is that I want to read in the date and time of the file as it is on the filesystem.

  • Have a look at xp_getfiledetails.

    Hope this helps

    Phill Carter

    --------------------

    Colt 45 - the original point and click interface

    --------------------
    Colt 45 - the original point and click interface

  • Perfectly done phillcart. this pointed me in the right direction and after a little googling, i came up with this site for all of you wondering about this and for the archives:

    http://www.dbazine.com/pf03sq33.shtml

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply