Hi guys,
I use the code below to generate the format file...I have one problem though... my fields are varchar and the prefix length in the format file is 2 which doesn't allow me to use the format file to load the data when I change the prefix length to 0 in the format file I am able to load the data... Is there anyway in the code below, I can make the prefix length to 0... it is for fixed width file with nothing as column delimiter and \r as row delimiter. Thanks in advance for help...
set @nsql = '
EXECUTE master..xp_cmdshell ' + '''' + 'bcp meta.dbo.' + @table_name + ' format nul -n -f"' + @format_file_location + '" -r -T' + ''''
Print @nsql
--Exec ( @nsql )
EXEC sp_executeSql @nsql