【问题标题】:Is it possible to export 'PRINT' commands into a file via bcp?是否可以通过 bcp 将“打印”命令导出到文件中?
【发布时间】:2017-07-18 08:04:31
【问题描述】:

我想导出 PRINT 命令的结果。我不想使用普通的 SQL Server 日志。 bcp可以吗?因为下面的命令不起作用。

例子:

SET @IPE = 'bcp PRINT ''Test''  queryout ' + @Path + '1b_Log_change_log_entry.txt -c -T'

结果:

Starting copy...
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC Driver 13 for SQL Server]BCP host-files must contain at least one column
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC Driver 13 for SQL Server]Unable to resolve column level collations
NULL
BCP copy out failed
NULL

【问题讨论】:

  • Print 不是查询,但Select 是.. 尝试选择而不是打印.. 'bcp Select ''Test'' queryout..
  • 谢谢!好评论!请制定作为答案。只有这样我才能将此问题标记为已完成。
  • 添加为答案..

标签: sql sql-server bcp


【解决方案1】:

Print 不是查询,但Select 是.. 尝试使用Select 而不是Print

SET @IPE = 'bcp SELECT ''Test''  queryout ' + @Path + '1b_Log_change_log_entry.txt -c -T'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-10-24
    • 2020-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-06
    相关资源
    最近更新 更多