代码之家  ›  专栏  ›  技术社区  ›  Chan

无法将SQL结果写入csv文件

  •  0
  • Chan  · 技术社区  · 6 年前

    我想将结果保存到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 回复  |  直到 6 年前