Thursday, December 10, 2009

File import in SQLServer 2005

After some tries, and despite of all the ultra-mega-super-lightning-integrated environment provided by Microsoft, I still think that the fastest way to bulk load a csv file into a SQLServer 2005 table is to use plain old Transact-SQL. Assuming you have a csv file with the same structure of an existing table, all you have to to do is write a few lines in your query window and fire an F5:

BULK INSERT your_table
from 'absolute/path/to/your/file'

Obviously, you could also use different terminators, but all you need to do is to alter the specified parameter.

No comments: