Bulk Import w/Format File and Text Fields - Why is it not working?
  Home FAQ Contact Sign in
microsoft.public.sqlserver.tools only
 
Advanced search
POPULAR GROUPS

more...

microsoft ... sqlserver.tools Profile…
 Up
Bulk Import w/Format File and Text Fields - Why is it not working?         


Author: Brad
Date: Aug 4, 2008 09:35

Here's what my data looks like:

"12312331 ","DOE, JOHN","3423423",0,1900-01-01
00:00:00,"","@@
","","JOHN DOE PROCESSING PLANT"

Here's my format file:

7.0
10
1 SQLCHAR 0 0 "\"" 0 ""
2 SQLCHAR 0 250 "\",\"" 1 "c1"
3 SQLCHAR 0 250 "\",\"" 2 "c2"
4 SQLCHAR 0 250 "\"," 3 "c3"
5 SQLCHAR 0 250 "," 4 "c4"
6 SQLCHAR 0 250 ",\"" 5 "c5"
7 SQLCHAR 0 250 "\",\"" 6 "c6"
8 SQLCHAR 0 250 "\",\"" 7 "c7"
9 SQLCHAR 0 250 "\",\"" 8 "c8"
10 SQLCHAR 0 250 "\"\r\n" 9 "c9"

I even tried simplying it into the simplist form possible because I
kept getting an error...
Show full article (1.45Kb)
4 Comments
Re: Bulk Import w/Format File and Text Fields - Why is it not working?         


Author: Erland Sommarskog
Date: Aug 4, 2008 14:45

Brad (bfreshour@gmail.com) writes:
> Here's what my data looks like:
>
> "12312331 ","DOE, JOHN","3423423",0,1900-01-01
> 00:00:00,"","@@
> ","","JOHN DOE PROCESSING PLANT"
>
> Here's my format file:
>
> 7.0
> 10
> 1 SQLCHAR 0 0 "\"" 0 ""
> 2 SQLCHAR 0 250 "\",\"" 1 "c1"
> 3 SQLCHAR 0 250 "\",\"" 2 "c2"
> 4 SQLCHAR 0 250 "\"," 3 "c3"
> 5 SQLCHAR 0 250 "," 4 "c4"
> 6 SQLCHAR 0 250 ",\"" 5 "c5"
> 7 SQLCHAR 0 250 "\",\"" 6 "c6"
> 8 SQLCHAR 0 250 "\",\"" 7 "c7"
> 9 SQLCHAR 0 250 "\",\"" 8 "c8" ...
Show full article (1.75Kb)
no comments
RE: Bulk Import w/Format File and Text Fields - Why is it not working?         


Author: Linchi Shea
Date: Aug 10, 2008 11:43

Personally, I'd rather pre-process the file to get it into the right format
to avoid using a format file. I find the BCP format file more trouble than
it's worth in most cases.

Linchi

"Brad" wrote:
> Here's what my data looks like:
>
> "12312331 ","DOE, JOHN","3423423",0,1900-01-01
> 00:00:00,"","@@
> ","","JOHN DOE PROCESSING PLANT"
>
> Here's my format file:
>
> 7.0
> 10
> 1 SQLCHAR 0...
Show full article (1.77Kb)
no comments
RE: Bulk Import w/Format File and Text Fields - Why is it not working?         


Author: Erland Sommarskog
Date: Aug 10, 2008 14:17

Linchi Shea (LinchiShea@discussions.microsoft.com) writes:
> Personally, I'd rather pre-process the file to get it into the right
> format to avoid using a format file. I find the BCP format file more
> trouble than it's worth in most cases.

Hey, that's only because you are not used to them. I think I also stayed
away from them for the first 8-10 years or so I used SQL Server, but
since then I have become a convert! They are quite intellectual challenges.
Sometimes you find that they can do a lot more than you initially expected.
True, it is also quite common that you hit a road-block.

Pre-processing a 1MB is no issue. Pre-processing a 1GB is likely to be.

... now, it only remains to see how long I will stay away from SSIS. This
far I have been successful.

--
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
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
no comments
RE: Bulk Import w/Format File and Text Fields - Why is it not work         


Author: Linchi Shea
Date: Aug 11, 2008 09:22

This may be a matter of experience and cognitive style, just like the
question of which GUI design is more intuitive.

But the fact you stayed away from it for 8~10 years says a lot about its
usibility already. I like to preprocess a file also because it has the added
value of validating the data in the file, which makes it much easier to debug
data import problems.
> Pre-processing a 1MB is no issue. Pre-processing a 1GB is likely to be.

Pre-processing a 1GB file is really rather trivial these days. Now, if it's
100GB, one may have to think a bit harder. Even there, going through that
file sequentially in one shot shouldn't be a huge issue as long as you don't
try to load the whole thing into memory as notepad likes to do. Considering
the benefit of precisely locate any data format problems during the
pre-process, I'd probably still go with pre-processing it.

Linchi

"Erland Sommarskog" wrote:
> Linchi Shea (LinchiShea@discussions.microsoft.com) writes:
>> Personally, I'd rather pre-process the file to get it into the right
>> format to avoid using a format file. I find the BCP format file...
Show full article (2.05Kb)
no comments

RELATED THREADS
SubjectArticles qty Group
RE: Import vCard should be able to import multiple contact in one filemicrosoft.public.outlook.contacts ·