我尝试在字段值前后添加双引号(“)。我的代码就像
ALTER procedure [dbo].[account_extension]
AS
Declare @V_SQL_TMP VARCHAR (4000)
SET @V_SQL_TMP =
'bcp " SELECT "*" from [dbo].[in_account_extension] " queryout "C:\in_account_extension.txt" -c -UTF8 -t"|" -T -Slocalhost'
EXEC xp_cmdshell @V_SQL_TMP
结果返回为 AA | BB | CC。预期输出为“ AA” |“ BB” |“ CC”