将CSV导入SQL Server(包括自动创建表) [英] Import CSV into SQL Server (including automatic table creation)
问题描述
我有几个 CSV文件,我要导入到 SQL Server数据库。我知道如果这是可能与BULK插入,但我想要一个解决方案,这样也导入表之前自动创建CSV文件的第一行,是列名称。
I have several CSV files, which I want to import into an SQL Server database. I know if this is possible with BULK insert, but I want a solution, so that also the import table is automatically created before on basis the first row of the CSV files,are the column names.
推荐答案
SQL Server Management Studio提供了一个导入/导出向导工具,可以自动创建表。
SQL Server Management Studio provides an Import/Export wizard tool which have an option to automatically create tables.
这是一个很好的指南:
http://www.mssqltips.com/sqlservertutorial/203/simple-way-to-import-data-into-sql-server/
Here is a nice guide: http://www.mssqltips.com/sqlservertutorial/203/simple-way-to-import-data-into-sql-server/
这篇关于将CSV导入SQL Server(包括自动创建表)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!