Friday, January 21, 2011

How to transfer data from CSV file to SQL

Hi,

First you need to create a table with similar number of columns (recommended), then create a format file from the table (using the bcp utility, already discussed in previous post), and then run the following command in sql management studio.

bulk insert tablename
from 'SourcetextfileCompletepath'
with (formatfile='formatfilelocation')