我想导出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
答案 0 :(得分:2)
Print
不是查询,但是Select
是..尝试Select
代替Print
SET @IPE = 'bcp SELECT ''Test'' queryout ' + @Path + '1b_Log_change_log_entry.txt -c -T'