Solved

xp_cmdshell and remote share on windows box

Posted on 2012-03-28
2
298 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
2 Comments
 
LVL 39

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:
sqlservr 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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now