无法将SQL结果写入CSV文件

时间:2019-02-19 08:19:08

标签: sql-server odbc sqlcmd

我想将结果保存到一个csv文件中。

我执行了以下命令。

sqlcmd -S localhost -d my_db-E -Q “SELECT TOP 10 * FROM [my_db].[dbo].[my_table]” -o “C:\CSVData.csv” -W -w 1024 -s”,”

然后,我打开了csv文件,但它仅包含三个错误行。

正确的方法是什么?

谢谢。

Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Named Pipes Provider: Could not open a connection to SQL Server [2]. .

Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login timeout expired.

Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : 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..

0 个答案:

没有答案