bcp字段终止符为空



https://technet.microsoft.com/en-us/library/aa196735(v=sql.80(.aspx

我正试图从bcp创建一个文件,该文件已成功创建,但我想使字段终止符-t为空。最接近的方法是使用null终止符,但它在字段之间留有空格。

这是我的密码。

select @cmd = 'bcp '+ @SP + ' queryout '+ @ruta+' -w -t -S '+@Servidor+ ' -U'+@user +' -P'+ @password
exec master..xp_cmdshell @cmd

我也试着让它在t之后没有任何符号,但它放了更多的空格。

select @cmd = 'bcp '+ @SP + ' queryout '+ @ruta+' -w -t -S '+@Servidor+ ' -U'+@user +' -P'+ @password
exec master..xp_cmdshell @cmd

使用-t""这基本上为您提供了一个固定宽度的导出文件,尤其是在用于定义为char()的源字段时例如:bcp "select * from TEST.dbo.tExportTst" queryout FixedWidth.txt -c -t"" -T -S Svrinstance

最新更新