J Wolfgang Goerlich's thoughts on Information Security
SQL Server Tip: Bulk load a csv file

By wolfgang. 17 February 2007 10:28

Create your table in SQL 2000 or 2005. The table's columns must match the .csv (comma separated value) columns. Then, from Query Analyzer, execute the following command:

-- Load contents of the csv file into the table.

Bulk
Insert
YourTable
From
'C:\YourDataFile.csv'
With (FieldTerminator = ',', RowTerminator = '\N'
)
Go

Tags:

History

    Log in