从Azure VM进行BCP查询:SQLState = 37000,NativeError = 40515不支持在'DBName.dbo.TableName'中引用数据库和/或服务器名称 [英] BCP queryout from Azure VM : SQLState = 37000, NativeError = 40515 Reference to database and/or server name in 'DBName.dbo.TableName' is not supported

查看:107
本文介绍了从Azure VM进行BCP查询:SQLState = 37000,NativeError = 40515不支持在'DBName.dbo.TableName'中引用数据库和/或服务器名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用本地计算机的SSMS中的BCP将Azure VM中的数据库表导出到文本文件中.

I was trying to export a table from database in Azure VM into a text file using BCP in my Local Machine's SSMS.

!! bcp "SELECT * FROM DBName.dbo.TableName" queryout D:\tablename.txt  
   -S AzureVM -U userName -P passWord -n

但是结果是以下错误

Starting copy...
SQLState = 37000, NativeError = 40515
Error = [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Reference to database and/or server name in 'DBName.dbo.TableName' is not supported in this version of SQL Server.
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC Driver 13 for SQL Server]Unable to resolve column level collations

BCP copy out failed

我尝试使用内部服务器而不是Azure VM运行类似的bcp命令.该命令已成功执行.

I tried to run a similar bcp command with an internal Server instead of Azure VM. The command was executed sucessfully.

解决了.我正在发布解决方案,因为它可能会帮助遇到相同问题的人.

The solution was figured out. I'm posting the solution since it may help someone having with the same problem.

推荐答案

修改了bcp命令,使其包含 -d 标志并指定数据库名称.

The bcp command was modified to include -d flag and specify the DataBase name.

!! bcp "SELECT * FROM dbo.TableName" queryout D:\account.txt -d DBName  
   -S AzureVM -U userName -P passWord -n

这篇关于从Azure VM进行BCP查询:SQLState = 37000,NativeError = 40515不支持在'DBName.dbo.TableName'中引用数据库和/或服务器名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆