Recommended method to import a .csv file into Microsoft SQL Server 2008 R2?

前端 未结 6 997
陌清茗
陌清茗 2021-01-02 04:21

What is your recommended way to import .csv files into Microsoft SQL Server 2008 R2?

I\'d like something fast, as I have a directory with a lot of .csv files (>500MB

6条回答
  •  爱一瞬间的悲伤
    2021-01-02 05:03

    First officially supported way of importing large text files is with command line tool called "bcp" (Bulk Copy Utility), very useful for huge amounts of binary data.

    Please check out this link: http://msdn.microsoft.com/en-us/library/ms162802.aspx

    However, in SQL Server 2008 I presume that BULK INSERT command would be your choice number one, because on the first place it became a part of standard command set. If for any reason you have to maintain vertical compatibility, I'd stick to bcp utility, available for SQL Server 2000 too.

    HTH :)

    EDITED LATER: Googling around I recalled that SQL Server 2000 had BULK INSERT command too... however, there was obviously some reason I sticked up to bcp.exe, and I cannot recall why... perhaps of some limits, I guess.

提交回复
热议问题