dbTalk Databases Forums  

Generating BCP input file from Perl/Unix

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Generating BCP input file from Perl/Unix in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
cldale@gmail.com
 
Posts: n/a

Default Generating BCP input file from Perl/Unix - 12-11-2007 , 10:55 AM






Hi,

I am attempting to process a proprietary formatted file into flat csv
for the purpose of bcp'ing into a SQL Server 2005 install. I tried
writing a processor in Perl that "works" except that the BCP tool in
windows just does not like the file, it gives me the "Unexpected
EOF...." error that is usually associated with misaligned fields.

I am pretty sure the cause of this is the end of line character
differences between platforms. I did some tests with a single row
manually inserted and bcp'd out of the SQL Server using csv format,
and the formatting looks identical to my perl output file. When I get
the hex editor involved, I can see the bcp output has 2 characters at
the end of each line (LF and CR if I am correct) whereas the unix
output has only 1.

I have been unable to get the perl script to output the right eol
characters for BCP to work.

I wrote another processor in C# under windows that works perfectly.

Is there a solution in perl? how do I terminate the lines properly? is
there a way to get BCP to recognize and accept different eol
characters?

Any advice is appreciated.

Thanks.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.