DECLARE @FileName varchar(50), @bcpCommand varchar(2000) SET @FileName = 'E:\dd.txt ' SET @bcpCommand = 'bcp "select top 10 * from MyTable" queryout "' SET @bcpCommand = @bcpCommand + @FileName + ' -U sa -P Pwd -c' print @bcpCommand EXEC master..xp_cmdshell @bcpCommand
-t
bcp Utility[^] -t field_term Specifies the field terminator. The default is \t (tab character). Use this parameter to override the default field terminator. For more information, see Specify Field and Row Terminators[^]. If you specify the field terminator in hexadecimal notation in a bcp.exe command, the value will be truncated at 0x00. For example, if you specify 0x410041, 0x41 will be used. If field_term begins with a hyphen (-) or a forward slash (/), do not include a space between -t and the field_term value.
-t field_term
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)