Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Copy at command line

Author  Topic 

rohans
Posting Yak Master

194 Posts

Posted - 2004-06-02 : 18:17:50
I am try =ing to copy some files from one server to a next using the following

declare @result varchar(1000)
EXEC @result = master.dbo.xp_cmdshell "copy g:\mssql\backup\ \\nas_serverA\dbbackup\sql\SQLserverB\temp"
GO

When I run it I get this

g:\mssql\backup\*
The system cannot find the file specified.
0 file(s) copied.
NULL


What am I doing wrong. I used this same command at another server and it worked, only difference was the source path.


All help appreciated.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-06-02 : 18:20:45
So what does this show when run in Query Analyzer connected to the same server:

EXEC master.dbo.xp_cmdshell 'dir g:\mssql\backup'

Have you tried xcopy g:\mssql\backup\*?

Tara
Go to Top of Page

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2004-06-02 : 19:35:31
is drive g: actually mapped on this server??? (i've had that problem before)

Corey
Go to Top of Page

rohans
Posting Yak Master

194 Posts

Posted - 2004-06-03 : 15:17:38
In query analyzer it gives me the following
--------------------
g:\mssql\backup\*
The system cannot find the file specified.
0 file(s) copied.
NULL
--------------

The G drive is local to the server. I tried XCOPY and it said 0 files copied.

All help appreciated.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-06-03 : 15:23:27
You need to figure out why the MSSQLSERVER service account (that's the account that runs xp_cmdshell) can't see that path. Can it see G at all:

EXEC master.dbo.xp_cmdshell 'dir g:\'

?

Is drive G local to the database server or to the server that you are running Query Analyzer on?

Tara
Go to Top of Page
   

- Advertisement -