Solved

xp_cmdshell and remote share on windows box

Posted on 2012-03-28
2
304 Views
Last Modified: 2012-03-29
Hi,
Does xp_chdshell works fine with remote server share like samba,dfs etc?
The services are started by windows system account.

-  xp_cmdshell to extract data
EXEC xp_cmdshell 'bcp "SELECT * FROM test1 " queryout "\\server\share1\test1.txt" -T -c -t,'

Thanks
0
Comment
Question by:crazywolf2010
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Assisted Solution

by:lcohan
lcohan earned 200 total points
ID: 37778108
As long as the SQL login running the command above has SUFFICIENT rights to that share it should not be a problem. We use samba server for our digital files and perform "imports/exports" of these digital files via SQL using similar method - we use SQLCMD utility not BCP.

http://msdn.microsoft.com/en-us/library/ms162773.aspx
0
 
LVL 10

Accepted Solution

by:
Ramesh Babu Vavilla earned 300 total points
ID: 37781299
yes it works but your bcp command needs the

-S Servername
-U Username
-P password

bcp DatabaseName.dbo.tableName out \\sqlservr\test.dat -S sqlservr\MSSQLSERVER05 -U admin
-P admin -n -T


is xp_cmdshell enable in  sql server,
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question