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

 All Forums
 Development Tools
 Other Development Tools
 CLR Stored Proc - reading a csv file into SQL

Author  Topic 

theboyholty
Posting Yak Master

226 Posts

Posted - 2011-12-23 : 08:32:46
I'm very new to vb.net 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.



---------------------------------------------------------------------------------
http://www.mannyroadend.co.uk A Bury FC supporters website and forum

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

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

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-01-01 : 08:51:29
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
   

- Advertisement -