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 2008 Forums
 SQL Server Administration (2008)
 copy command in sql

Author  Topic 

amirs
Constraint Violating Yak Guru

260 Posts

Posted - 2010-09-23 : 05:37:14
Dear User

I have execute the sql command to copy local drive to network drive but their is not copy the file. it display access is denied error .
i have manual copy the network path it is ok. but i have use command their is not work.
i have use sql2008 server and use following command

EXEC master..xp_cmdshell 'copy C:\test.bak \\netserver\Datafolder\'

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-09-23 : 06:17:04
Few reasons are:
1. XP_cmdshell execution may not be enabled in sql server.
2. The networkpath (\\netserver\Datafolder\) may not be having write permission. SQL Server may not be using your windows login id but may be the one used for startup (Not fully sure on this point).

A quick question: Why you want to copy the files using sql server ?
Go to Top of Page
   

- Advertisement -