Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #559

Re: Embedded <CRLF> in text file

From Erland Sommarskog <esquel@sommarskog.se>
Newsgroups comp.databases.ms-sqlserver
Subject Re: Embedded <CRLF> in text file
Date 2011-07-21 11:05 +0200
Organization Erland Sommarskog
Message-ID <Xns9F2970D5C97ECYazorman@127.0.0.1> (permalink)
References <j08ju6$lhe$1@news.ett.com.ua>

Show all headers | View raw


Kurt Dicus (kdicus@dicus.com) writes:
> This would be a perfect file!
> 
> ID<t>STATUS<t>DESCRIPTION<t>ACTIVE<c>
> 1<t>active<t>Test description short<t>true<c>
> 2<t>under construction<t>Test description 2<t>false<c>
> 
> What the file actually looks like.
> ID<t>STATUS<t>DESCRIPTION<t>ACTIVE<c>
> 1<t>active<t>Test<c>   -- it is only the DESCRIPTION field that has the 
> premature break
> description<c>
> long string<t>true<c>
> 2<t>under construction<t>Test description 2<t>false<c>
 
Have you tried to bulk-load this misfit with BCP or BULK INSERT? I belive
that should work. They look for one field at a time, so when they look for 
the third field, they are looking for tab characters to terminate that 
field. The CRLF will be consumed as data.
-- 
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Embedded <CRLF> in text file "Kurt Dicus" <kdicus@dicus.com> - 2011-07-21 00:17 -0700
  Re: Embedded <CRLF> in text file Erland Sommarskog <esquel@sommarskog.se> - 2011-07-21 11:05 +0200
    Re: Embedded <CRLF> in text file "Kurt Dicus" <kdicus@dicus.com> - 2011-07-21 02:14 -0700

csiph-web