Link to home
Start Free TrialLog in
Avatar of erde
erdeFlag for Belgium

asked on

Bulk insert

Hi,

I need to load a file of which the row terminator is only a linefeed (0A). How can I load this file? BULK INSERT only has \n (0D0A) and \r (0D) as row terminators. If you use \n, BULK INSERT od BCP always add the 0D.

tnx.
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

see this article:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad_impt_bcp_0fqq.asp
<...>
When you use bcp interactively and specify \n (newline) as the row terminator, bcp prefixes the \r (carriage return) character automatically.
<...>

I suggest that you specify the parameters using -f<formatfile> options:

-f format_file

Specifies the full path of the format file that contains stored responses from a previous use of bcp on the same table or view. Use this option when using a format file created with the format option to bulk copy data in or out. Creation of the format file is optional. After prompting you with format questions, bcp prompts whether to save the answers in a format file. The default file name is Bcp.fmt. bcp can refer to a format file when bulk copying data; therefore, reentering previous format responses interactively is not necessary. If this option is not used and -n, -c, -w, -6, or -N is not specified, bcp prompts for format information


CHeers
ASKER CERTIFIED SOLUTION
Avatar of dewpat
dewpat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of erde

ASKER

Works fine. Thanks.
Avatar of brokeMyLegBiking
brokeMyLegBiking

solved my problem as well!

-grateful bystander
very slick!  thanks dewpat