Copy File and error code
- From: "Scott" <sbailey@xxxxxxxxxxxxxxx>
- Date: Fri, 12 Jun 2009 11:05:43 -0500
I'm copying a file across the network. My code works, but it returns the below results when successful. Is there any way to modify my code to force sql to return perhaps a simple 0 for success and maybe 1 for an error?
CODE:
DECLARE @sMsg varchar(3000)
DECLARE @sSource varchar(1000)
DECLARE @sTarget varchar(1000)
SET @sSource = '\\Server1\C\data\myDB.MDB'
SET @sTarget = 'D:\Data\myDB.MDB'
--SET @sMsg = N'copy ' + @sSource + N' ' + @sTarget
SET @sMsg = 'copy "' + @sSource + '" "' + @sTarget + '"';
EXEC master.dbo.xp_cmdshell @sMsg
RESULTS:
1 file(s) copied
NULL
.
- Follow-Ups:
- Re: Copy File and error code
- From: Tibor Karaszi
- Re: Copy File and error code
- Prev by Date: Re: When are TRC files created?
- Next by Date: Re: What do people spend on self-education in the trade?
- Previous by thread: How to automatically insert new records into Child Table using Tri
- Next by thread: Re: Copy File and error code
- Index(es):
Relevant Pages
|
Loading