简体   繁体   English

错误= [Microsoft] [SQL Server本机客户端11.0]

[英]Error = [Microsoft][SQL Server Native Client 11.0]

This error appear when write this code in sql server 2012: 在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. 错误= [Microsoft] [SQL Server Native Client 11.0]建立与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. 检查实例名称是否正确以及SQL Server是否配置为允许远程连接。 For more information see SQL Server Books Online. 有关更多信息,请参见SQL Server联机丛书。

How to solve it? 怎么解决呢?

The query you have made works correctly. 您进行的查询可以正常工作。 However, you have not enabled TCP/IP within SQL Server. 但是,您尚未在SQL Server中启用TCP / IP。 This can be done by doing the following: 这可以通过执行以下操作来完成:

  1. Open up 'SQL Server Configuration Manager' 打开“ SQL Server配置管理器”
  2. Select 'SQL Native Client Configuration' 选择“ SQL Native Client配置”
  3. On the right hand pane, right click on TCP/IP and select enable 在右侧窗格上,右键单击“ TCP / IP”,然后选择“启用”。
  4. Restart SQL Server Service 重新启动SQL Server服务

Your query should now work correctly. 您的查询现在应该可以正常工作。

See the following msdn document for further info. 有关更多信息,请参见以下msdn文档。 Enable TCP/IP Network Procotol for SQL Server 为SQL Server启用TCP / IP网络Procotol

Please let me know if this doesn't resolve the issue as there may be other configuration required. 如果这不能解决问题,请告诉我,因为可能需要其他配置。

EDIT: 编辑:

Can you try running the following from the command line (ie cmd.exe): 您可以尝试从命令行(即cmd.exe)运行以下命令吗?

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

Let me know if this works for you or not (so we can see if it's BCP or xp_cmdshell causing the issue). 让我知道这是否对您有用(因此我们可以看看是BCP还是xp_cmdshell引起了该问题)。 Can you also look into the following: 您还可以研究以下内容吗?

  1. SQL server is configured to allow remote connections SQL Server配置为允许远程连接
    • Within SSMS, right click the server name>Properties>Connections and tick the box 'Allow remote connections' 在SSMS中,右键单击服务器名称>“属性”>“连接”,然后选中“允许远程连接”框
  2. Is your user a sysadmin? 您的用户是系统管理员吗?
  3. Where is your SQL server situated? 您的SQL服务器在哪里? (ie is it a local installation or on server on your network?) (即它是本地安装还是在网络上的服务器上?)
  4. Also is it an instance of SQL? 也是SQL的实例吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Microsoft SQL Server本机客户端11.0:无法打开数据库 - Microsoft SQL Server Native Client 11.0 : Cannot open database SQL Server在ASP经典版[Microsoft]中执行SQL存储过程时出错[SQL Server Native Client 11.0] [SQL Server]错误 - SQL Server Error executing SQL stored procedure in ASP classic [Microsoft][SQL Server Native Client 11.0][SQL Server] Error 经典ASP Microsoft SQL Server本机客户端11.0错误'80040e14'用户登录失败,但不是我指定的用户登录 - Classic ASP Microsoft SQL Server Native Client 11.0 error '80040e14' Login failed for user, but not the one I specified 无法运行查询:SQLSTATE [42000]:[Microsoft] [SQL Server Native Client 11.0] [SQL Server]')'附近的语法不正确 - Failed to run query: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near ')' [Microsoft] [SQL Server本机客户端11.0] SQL Server网络接口:连接字符串无效 - [Microsoft][SQL Server Native Client 11.0]SQL Server Network Interfaces: Connection string is not valid odbc调用失败[microsoft] [sql server本机客户端11.0] [sql server]多部分标识符盘绕不绑定 - odbc call failed [microsoft] [sql server native client 11.0] [sql server] the multipart identifier coild not be bound linux pyodbc连接错误“无法打开lib'SQL Server Native Client11.0'” - Error with linux pyodbc connection “Can't open lib 'SQL Server Native Client11.0'” SSIS OLE DB 记录可用。 来源:“Microsoft SQL Server Native Client 11.0” Hresult:0x80004005,无法确定元数据 - SSIS An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005, The metadata could not be determined sqlcmd:本机客户端11.0不支持到SQL Server 2000的连接 - sqlcmd: Native Client 11.0 does not support connections to SQL Server 2000 错误 [42000] [Microsoft][SQL Native Client][SQL Server]关键字“SET”附近的语法不正确 - ERROR [42000] [Microsoft][SQL Native Client][SQL Server]Incorrect syntax near the keyword 'SET'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM