BCP queryout from Azure VM : SQLState = 37000, NativeError = 40515 Reference to database and/or server name in 'DBName.dbo.TableName' is not supported

天涯浪子 提交于 2021-01-28 06:44:30

问题


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

But following error was the result

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

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.


回答1:


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


来源:https://stackoverflow.com/questions/52313532/bcp-queryout-from-azure-vm-sqlstate-37000-nativeerror-40515-reference-to

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!