|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, January 18, 2013 11:03 AM
Points: 55,
Visits: 60
|
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Wednesday, January 04, 2006 3:35 AM
Points: 31,
Visits: 1
|
|
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
|
|
|
|
|
SSCrazy Eights
        
Group: Moderators
Last Login: Tuesday, April 09, 2013 12:53 PM
Points: 8,357,
Visits: 684
|
|
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.
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Yesterday @ 5:53 AM
Points: 2,692,
Visits: 1,074
|
|
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]
Hope this helps Phill Carter -------------------- Colt 45 - the original point and click interface 
Australian SQL Server User Groups - My profile Phills Philosophies Murrumbeena Cricket Club
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Monday, June 01, 2009 8:11 AM
Points: 19,
Visits: 22
|
|
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!
|
|
|
|