Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 Development Tools
 Other Development Tools
 CLR Stored Proc - reading a csv file into SQL
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

United Kingdom
226 Posts

Posted - 12/23/2011 :  08:32:46  Show Profile  Visit theboyholty's Homepage  Reply with Quote
I'm very new to although fairly experienced in SQL. I'm trying to find a quick and robust way of reading the contents of a csv file into a SQL table so my first question is simply, Can it be done?

I've so far user IO.File.ReadAllText to read the contents of the file into a variable, now I need to know how to get the contents of that variable to do something useful.

--------------------------------------------------------------------------------- A Bury FC supporters website and forum

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 12/23/2011 :  10:48:12  Show Profile  Reply with Quote
it can be done using multiple methods like Export/Import wizard , OPENROWSET etc

SQL Server MVP

Go to Top of Page

Most Valuable Yak

15732 Posts

Posted - 01/01/2012 :  08:51:29  Show Profile  Visit robvolk's Homepage  Reply with Quote
There's also the bcp utility and the BULK INSERT command. Unless you have to deal with embedded quotes, commas, or line feeds, these are typically easier and faster to import.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000