473,508 Members | 2,369 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bulk Import with header in text file

I would appreciate some help on a procedure that I have. Using Bulk
Insert, I would like to import records from a text file. The issue I
have is the file contains a header - '1AMC_TO_Axiz' and a footer
'1AMC_TO_Axiz2". Using a format file, I can get the import to work by
editing the file and removing these two entries. Is there a way to
setup the format file to skip these two entries? My file currently
looks like this:
7.0
16
1 SQLCHAR 0 50 "|" 1 keyMemberNo
2 SQLCHAR 0 10 "|" 2 fldEffdate
.................
16 SQLCHAR 0 10 "\r\n" 16 fldNewRecord

Thanks
Charles

Nov 28 '05 #1
3 2621
you should be able to write a batch file to open the text file and
replace those words w/ a NULL string.

Nov 28 '05 #2
(cb****@bjtsupport.com) writes:
I would appreciate some help on a procedure that I have. Using Bulk
Insert, I would like to import records from a text file. The issue I
have is the file contains a header - '1AMC_TO_Axiz' and a footer
'1AMC_TO_Axiz2". Using a format file, I can get the import to work by
editing the file and removing these two entries. Is there a way to
setup the format file to skip these two entries? My file currently
looks like this:
7.0
16
1 SQLCHAR 0 50 "|" 1 keyMemberNo
2 SQLCHAR 0 10 "|" 2 fldEffdate
................
16 SQLCHAR 0 10 "\r\n" 16 fldNewRecord


BCP is very squared, and there is no way to specify a footer or a header.
The one exception is when you can hide the header in the format somehow.
If the headers fits into the format, you can the FIRSTROW and LASTROW
options to skip them.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Nov 28 '05 #3
Thanks for the replies! At least I now know that I did not miss
something!

Nov 30 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
4832
by: atse | last post by:
Hi, I am still stick on the text file being imported to database. Can anybody help? I have just done the csv format files. And then I work on text and DAT formats, but I have problem to import...
0
2139
by: adrian GREEMAN | last post by:
When I try to import a text file with new data for an existing table I get the error "1148 - the used command is not allowed with this MySQL version." I have tried with both PHPMyAdmin2.3 and...
3
2867
by: Frank Reichenbacher | last post by:
I've been developing an Access database for our small office for several years now so I am not a newbie. However, I have a need for which I am not finding a mechanism to accomplish in the material...
6
2876
by: MLH | last post by:
I was able to do this from Access 2.0. It had to be set up, of course, but it could be done. I'm unsure as to why Access 97 says "Can't find file"??? ...
0
1255
by: TJS | last post by:
I need to import a delimited text file to an msde table, I found discussion item below. anything available for msde which is comparable to this Jet example? =================================...
0
2764
by: Shawn Ferguson | last post by:
With the help of you, I've been able to successfully load my database with the contents of a "comma" delimited file. It loads about 5000 records in about 3 seconds:) Now I have another problem. ...
14
11151
by: mfrsousa | last post by:
hi there, i have a huge large text file (350.000 lines) that i want to import to a MS Acccess Database, of course i don't want to use Access, but do it with C#. i already have tried the...
8
2991
by: diasdaman | last post by:
I know how to import text files, but in this case I need to import a text file line by line on an on-the-fly basis, such that the Access will look at the first two digits of a line, and then import...
6
5093
by: serdar | last post by:
Hi, I'm developing a flash game and need to read data from a text file (about 100k). I do not want to read it from an external file. -Is it possible to somehow import a text file into flash and...
12
3124
by: Miguel Valenzue | last post by:
I collect traffic data from a machine that outputs text files with the data. I want to import each text file as it's own table into an Access database and do it without having to run the import...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7321
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5047
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1547
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
414
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.