xp_cmdshell 分号分隔

xp_cmdshell semi-colon separation

我正在使用 xp_cmdshell,我希望文本文件的输出以分号分隔。我测试了以下内容:

-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1;
GO
-- To update the currently configured value for advanced options.
RECONFIGURE;
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1;   -- 1 for at enable
GO
-- To update the currently configured value for this feature.
RECONFIGURE;
GO

-- Extracting information from the database
EXEC xp_cmdshell 'bcp "SELECT TcpIpAddress FROM [SIT-DVH].[dbo].[Preb_Idera]" queryout "C:\Output\Ip_outputSemi.txt" -T -c -t;'


-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1;
GO
-- To update the currently configured value for advanced options.
RECONFIGURE;
GO
-- To disable the feature.
EXEC sp_configure 'xp_cmdshell', 0;   -- 0 for at disable
GO
-- To update the currently configured value for this feature.
RECONFIGURE;
GO

我看到好几个地方都说setting -t;应该使输出以分号分隔,但输出仍然是:

xxxx yyyy zzzz

我找到了解决方案,因为输出如下:

xxx
zzz
yyy

我需要更改-t;至-r;因为我每行只有一个字段和 [-r row_term],输出如下:

xxx;zzz;yyy