July 6, 2004 at 1:56 pm
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/
August 2, 2004 at 2:52 am
Small comment.
I really don't like On Error Resume next in any code - I know vbscripts error handling is poor in the extreme, but I'd write any errors to a text file and then (probably separately) mail an administrator the contents of the text file if there were any. That way you get notified if your maintenance is failing.
Niall Litchfield
Senior DBA
http://www.niall.litchfield.dial.pipex.com
August 2, 2004 at 6:22 am
You would still need On Error Resume Next to accomplish. I prefer to wrap in functions each bit so I have the effectiveness of a GOTO by being able to jump out of points return the error and have error logic (works in VBScript just takes a bit of work covering sometimes). Just make sure you only use it in conditions you specifically want to trap and handle and make sure you GOTO 0 at you earliest convience. You don't want your code getting out of hand because of the RESUME NEXT condition, I have seen that happen so many times.
August 3, 2004 at 9:29 pm
As one who has been bitten by "On Error Resum Next" I now eliminate it wherever it's encountered. The following snippet is much better for VBScript error handling
On Error Resume Next
[perform a statement]
[capture error variables to local variables]
On Error Goto 0
[Check local variable for error]
etc...
Also, you don't need to use VBScript to delete the files, including those in subdirectories. I use a combination of xp_dirtree, xp_getfiledetails and xp_cmdshell to list and delete files.
xp_dirtree [path], [depth], [include files]
xp_getfiledetails [file spec]
--------------------
Colt 45 - the original point and click interface
August 2, 2005 at 2:01 pm
I was trying to copy backups from one server to another by:
Exec usp_CopyFiles '\\ServerA\FolderName','\\ServerB\FolderName'
I got the following result:
output
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Invalid drive specification
0 File(s) copied
NULL
Can anybody tell me why?
Thanks in advance!
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply