问题
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