﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by Haidong Ji / Article Discussions / Article Discussions by Author  / Using Different Techniques for SQL Server Automation / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sun, 21 Mar 2010 17:07:06 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Using Different Techniques for SQL Server Automation</title><link>http://www.sqlservercentral.com/Forums/Topic124948-102-1.aspx</link><description>&lt;P&gt;I was trying to copy backups from one server to another by:&lt;/P&gt;&lt;P&gt;Exec usp_CopyFiles '\\ServerA\FolderName','\\ServerB\FolderName'&lt;/P&gt;&lt;P&gt;I got the following result:&lt;/P&gt;&lt;P&gt;output                                                                                                                                                                                                                                                          --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Invalid drive specification0 File(s) copiedNULL&lt;/P&gt;&lt;P&gt;Can anybody tell me why?&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;img src='images/emotions/doze.gif' height='20' width='20' border='0' title='Doze' align='absmiddle'&gt;&lt;/P&gt;</description><pubDate>Tue, 02 Aug 2005 14:01:00 GMT</pubDate><dc:creator>janiezhao</dc:creator></item><item><title>RE: Using Different Techniques for SQL Server Automation</title><link>http://www.sqlservercentral.com/Forums/Topic124948-102-1.aspx</link><description>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 handlingOn 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] </description><pubDate>Tue, 03 Aug 2004 21:29:00 GMT</pubDate><dc:creator>philcart</dc:creator></item><item><title>RE: Using Different Techniques for SQL Server Automation</title><link>http://www.sqlservercentral.com/Forums/Topic124948-102-1.aspx</link><description>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.</description><pubDate>Mon, 02 Aug 2004 06:22:00 GMT</pubDate><dc:creator>Antares686</dc:creator></item><item><title>RE: Using Different Techniques for SQL Server Automation</title><link>http://www.sqlservercentral.com/Forums/Topic124948-102-1.aspx</link><description>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. </description><pubDate>Mon, 02 Aug 2004 02:52:00 GMT</pubDate><dc:creator>nlitchfield</dc:creator></item><item><title>Using Different Techniques for SQL Server Automation</title><link>http://www.sqlservercentral.com/Forums/Topic124948-102-1.aspx</link><description>Comments posted to this topic are about the content posted at &lt;A HREF=http://www.sqlservercentral.com/columnists/hji/usingdifferenttechniquesforsqlserverautomation.asp&gt;http://www.sqlservercentral.com/</description><pubDate>Tue, 06 Jul 2004 13:56:00 GMT</pubDate><dc:creator>Haidong Ji</dc:creator></item></channel></rss>