Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Format File 9.0 Prefix Length

Author  Topic 

GhantaBro
Posting Yak Master

215 Posts

Posted - 2009-06-24 : 23:42:12
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\n 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\n -T' + ''''

Print @nsql
--Exec ( @nsql )
EXEC sp_executeSql @nsql

GhantaBro
Posting Yak Master

215 Posts

Posted - 2009-06-25 : 13:01:42
Any help is appreciated. thanks!
Go to Top of Page
   

- Advertisement -