473,840 Members | 1,451 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Flat file parsing into SQL Server 2000

Hi,
I was wondering if anybody knew of any other ways of efficiently
parsing a flat file into SQL Server 2000 using C#. The flat files are
tab delimited. And the general file size is around 1 GB so this code
has to be ultra efficient. Its a colllection of few flat files which
willl be mapped to a relational structure in the database.

Following are the options I am looking at:
1. Using Datasets to read the data and execute one stored procedure per
row. I am not finding this efficient at all obviously.

2. Reading the flat file, rewriting it so as to map it exactly to a
table and then using Interop to invoke Sql BCP utility. This approach
looks good but I would like to explore a bit more and see if I can
avoid using an interop.

Please only give me approaches you think can be explored. I am not
after code here yet.

Thanks.

Regards
Neural

Feb 8 '06 #1
2 2638
If you are looking for real good effeciency, I would suggest looking at
csvReader (http://www.csvreader.com). This guy has made an app that is
very effecient at importing data into sql server. He has it very
effecient to the point where the import can be as fast as running a DTS
from sql server.

Other than that, I would suggest using a BULK IMPORT sql statement:

BULK INSERT tableToImportTo FROM 'flatFile.csv' WITH (FIELDTERMINATO R =
',')

You'll have to change the field terminator to a tab, not sure what the
keyword to use there is.

Feb 8 '06 #2
Hi,

"Neural" <rr*******@gmai l.com> wrote in message
news:11******** ************@o1 3g2000cwo.googl egroups.com...
Hi,
I was wondering if anybody knew of any other ways of efficiently
parsing a flat file into SQL Server 2000 using C#. The flat files are
tab delimited. And the general file size is around 1 GB so this code
has to be ultra efficient. Its a colllection of few flat files which
willl be mapped to a relational structure in the database.

Following are the options I am looking at:
1. Using Datasets to read the data and execute one stored procedure per
row. I am not finding this efficient at all obviously.

2. Reading the flat file, rewriting it so as to map it exactly to a
table and then using Interop to invoke Sql BCP utility. This approach
looks good but I would like to explore a bit more and see if I can
avoid using an interop.

I do something similar with a DTS package. I create & test the package in
enterprise manager, once I know for sure it does work I save it to file
(using one of the DTS screens) then I load it in the code and change the
source & target connection as needed. I found this pretty fast and
configurable.
I did not tried BCP though, so you should also explore that path.

BTW, you do not need to p/invoke BCP it's an executable that you run using
the Process class.

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Feb 8 '06 #3

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

Similar topics

1
2671
by: .d.hos | last post by:
ok, fairly new to python, relatively familiar w/ ms-sql. here's my issue: my .py script parses the contents of a (tab delim.) flat file, then attempts to insert the information into the db. I've been fighting this for a day or so, and i'm stuck on the db insertion... basically the script uses .readlines() to capture the flat file contents, and stick the *record* into a container list...
0
313
by: mwazir | last post by:
Dear all, I have a requirement while parsing a delimited flat file and I was wondering if there is a simpler solution that what I have in mind. Basically I need to pull out a line from the flat file and the information I am given is the line number and the name of the file. Therefore I have thought of implementing something like this. Private Function getLineFromFile(ByVal sFilePath As String, ByVal lStringNo As Long) As String
13
3434
by: raykyoto | last post by:
Hi all, I'm sure this is a popular question that comes up every few months here. Indeed, I've looked at some of the past postings, but I would like to ask things differently. Basically, I'm using a flat file to storing data. I have to do this because mySQL is not installed on my web server, and I am not the root user. The amount of data is so small, that it isn't worth a full-blown database anyway. However, while the data is...
3
2874
by: Joe | last post by:
Hi I have a dataset with 2 tables and Relations What is the best way to flatten the 2 files to a new table or xml or file I can loop thru table1 and get the childrows or I can do an Xpath on the xml but not sure how to get relation from xsd or Is there another alternative???
0
1088
by: raginireddy | last post by:
Hi , I had a Flat file with the following Data B10001 U1001 IT2003 12-04-1999 S B10001 U1001 IT2004 04-05-1999 S B10001 U2001 IT2005 07-06-2000 S XWQ01 XWB2 IXIT00 11-04-1998 S
4
1668
by: thenewuser | last post by:
Hi all, I am working on windows 2000 and using php 5.0 and apache 2.0.59. I am facing a problem while parsing a text file.Actually I am using a pop server for parsing an email.I am downloading new mails from that server using php and parsing the attachments.I want to parse text files as well. BUt when i save the attached .txt file on my machine, "=20" gets appended at the end of every line. If the file is an xml file, sometimes "=90" gets...
1
2071
by: hkhella | last post by:
I receive several flat files daily that need to be improted into my Access Database. Each file record starts with a specific letter or group of letters, the following lines or rows in the flat file starts with an identifier followed by several data fields each seperated by ^ and each line end with ^. The record ends with a specific letter (T) or group of letters. Each file received may contain one or more records. The end of file is marked by...
15
5286
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to show - text boxes, input boxes, buttons, hyperlinks ie the usual. The data is not obtained directly from a database.
3
3180
by: Flugeldorph | last post by:
I am new to Visual Basic, my preferred languages is C or C++. I am trying to load a local database with data that I am reading from a delimited flat file. I have created the database tables and added all primary keys and a set of foreign keys. I have also created a Dataset for same. Now I was expecting that I could load the data set from the data that I am parsing from the flat file. Houever when I attempt to enter data into the dataset I can't...
0
9856
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9698
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10657
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10299
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5684
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4495
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 we have to send another system
2
4071
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3136
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.