我想导出 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
是。尝试使用 Select
而不是 Print
SET @IPE = 'bcp SELECT ''Test'' queryout ' + @Path + '1b_Log_change_log_entry.txt -c -T'
关于sql - 是否可以通过 bcp 将 'PRINT' 命令导出到文件中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45160888/