July 31, 2012 at 6:55 am
Hi guys. I am importing files from A SAP extract which use a UNIX format. The carriage return in UNIX is {LF} (LINE FEED).
How do I either convert the file to PC format easily or use {LF} in the BCP argument?
This is my CMD command for BCP.
C:\Program Files\Microsoft SQL Server\100\Tools\Binn>bcp "BI_STAGING.[SAPecc6].[Staging_VendorBCPTest]" in "T:\Business Intelligence\SAP Extracts\20120627_data_Vendor.txt" -c -t"|" -r{LF} -F2 -T -S "03RNB-BIW01\BIDW"
the following dont work. -r{LF}, -r\LF, -r"LF"
Once I get it working in CMD, I will create a packege for it.
ANy ideas?
thanks
Ian
Ian Cockcroft
MCITP BI Specialist
August 2, 2012 at 12:03 am
You posted this in the Integration Services forum so why use bcp? Why not SSIS? If you do in fact need bcp you'll have to use a format file to specify the end of line char. Unfortunately when specifying on the command line using -r bcp prepends it with \r resulting in a runtime value of \r, which is not what you need.
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
August 2, 2012 at 1:35 am
Hi, thanks for the reply.
we originally were using a script to pick up the files and build staging tables based on the file content and then use bcp to load them. If the file layout changed, we could handle it easier once it was in SQL.
have had a rethink and we going to use SSIS data flow going forward. if the files change, to bad, their fault.
Ian Cockcroft
MCITP BI Specialist
August 4, 2012 at 3:20 pm
On Unix/Linux systems there is command called unix2dos which can convert LF text files to CRLF text files. Otherwise the same is possible with sed, awk, perl, etc.
Also most ftp servers can convert uncompressed text files from LF format to CRLF format on the fly by using ASCII transfer instead of binary transfer. So if you are already using ftp to transfer the files on a local area network this could be an option.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply