Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This error appear when write this code in sql server 2012:

EXEC xp_cmdshell 'bcp "select [ProductID],[ProductName],[UnitPrice] from Northwind.dbo.Products" queryout "d:\bcptest2.txt" -T  -c -t, '


Error = [Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.

How to solve it?
Posted
Comments
CHill60 7-Feb-13 5:35am    
Do you have a SQL instance called Northwind ?
engmebeed 7-Feb-13 6:30am    
This is as Example, really i have the required instance
Chris Reynolds (UK) 7-Feb-13 9:16am    
Have you tried specifying the SQL instance with the -S parameter?

1 solution

I'm using ss2k08 but this might go in ss2k12, for the same reason.
EXEC sp_configure 'xp_cmdshell', 1
GO
RECONFIGURE

And a quick test of a commandline like yours:
EXEC xp_cmdshell 'dir /b /s c:\users\mb\my documents\sql server management studio\*.txt'

The sql facility "xp_cmdshell" is by default disabled for obvious reasons.

If this doesn't clear up the error with the client, check the instance that's running in the services under the compmgmt.msc console. Might even have to change the way the log on is happening. Failing that, read the directions for ss use in BOL.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900