Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 10th, 2006, 05:02 PM
Authorized User
Join Date: Dec 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to arielote Send a message via MSN to arielote Send a message via Yahoo to arielote
Default Import a Comma separated txt file to SQL table

Hi fellows!

I need to read from disk a TXT file, comma separated, then to populate to SQL table.
By default I was thinking into use streamreader.readline(), parsing every record in order to split each field, then execute INSERT command in order to write a new record into SQL table.
Because I can not forget my days of C (K&R code) I would like to ask if somebody can give some ideas, in order to use all features of C#.
Perhaps some functions, something at help, etc.


Ariel Folonier
San Nicolas
Ariel Folonier
San Nicolas
Old April 5th, 2006, 06:09 AM
Registered User
Join Date: Apr 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts


your answer isn't in C#.
You have to use the "Bulk Insert" sql function.
If you use Sql Server, you'll find all details on the function in Transact-Sql Help

Old April 17th, 2006, 01:08 AM
Registered User
Join Date: Apr 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to panic_attack Send a message via Yahoo to panic_attack

Hi there,
I have worked on "BULK INSERT" command but noticed that
to import a text file to sql by using "bulk insert" command
i do already have a table and import the text file into this table.
But there is a command called "openrowset" with this command
programmer does not have to have a table in database to import a text file by using "openrowset"
does anyone help me with this pls?
i need a command to import a text file into SQL Server 2000 automaticly
"openrowset" does not help me because it has no parameter that you can specify "rowdelimiter" or "fielddelimiter". "bulk insert" doenst help me because i must have a table in database.
as a result i need a command that should be able to do both of this command above. does anyone could help?
or may be there is another way to do it?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting a csv file (comma separated) micharl Beginning VB 6 6 May 7th, 2008 10:10 PM
Comma Separated values aldwinenriquez SQL Server 2005 3 June 1st, 2007 08:52 PM
comma separated list MunishBhatia SQL Server 2000 11 March 21st, 2007 03:56 PM
Comma Separated Column Value thru T-SQL subhendude SQL Server 2000 2 December 12th, 2006 01:42 PM
Select from Comma Separated Values sasidhar79 SQL Server 2000 2 March 28th, 2005 06:58 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.