Friday, February 24, 2012

file operations

I'm writing a proc to do tlog backups. I want to validate the path before
attempting to issue the backup command but I don't see any documented file
handling funtions in T-SQL. What's the best approach for this?
Thanks,
Bob Castleman
DBA PoseurImplement a DTS package that first uses the FSO.FileExists function via a
ActiveX Script task to verify the folder. If the task returns success, then
use a Execute SQL task to call your SP.
Function Main()
Main = DTSTaskExecResult_Failure
sCopyFrom = "c:\temp\xxx.tmp"
sCopyTo = "c:\temp\xxx.dat"
set FSO = CreateObject("Scripting.FileSystemObject")
if not FSO.FileExists( sCopyFrom ) then
exit function
end if
if FSO.FileExists( sCopyTo ) then
FSO.DeleteFile sCopyTo
end if
FSO.CopyFile sCopyFrom, sCopyTo
set FSO = nothing
Main = DTSTaskExecResult_Success
End Function
"Bob Castleman" <nomail@.here> wrote in message
news:e180EavYFHA.1028@.TK2MSFTNGP10.phx.gbl...
> I'm writing a proc to do tlog backups. I want to validate the path before
> attempting to issue the backup command but I don't see any documented file
> handling funtions in T-SQL. What's the best approach for this?
> Thanks,
> Bob Castleman
> DBA Poseur
>

No comments:

Post a Comment