是否可以通过 bcp 将 'PRINT' 命令导出到文件中?

Is it possible to export 'PRINT' commands into a file via bcp?

我想导出 PRINT 命令的结果。我不想使用正常的 SQL 服务器日志。 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 是.. 尝试 Select 而不是 Print

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