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 – Import CSV into SQL Server (including automatic table creation)
csvsqlsql server
Related Topic
- Sql-server – How to check if a column exists in a SQL Server table
- Sql – How to concatenate text from multiple rows into a single text string in SQL Server
- Sql-server – the best way to auto-generate INSERT statements for a SQL Server table
- Sql – How to get column names from a table in SQL Server
- Sql – How to UPDATE from a SELECT in SQL Server
- Sql – Finding duplicate values in a SQL table
- Mysql – How to import an SQL file using the command line in MySQL
- R – How far do you go with YAGNI?
Best Answer
SQL Server Management Studio provides an Import/Export wizard tool which have an option to automatically create tables.
You can access it by right clicking on the Database in Object Explorer and selecting Tasks->Import Data...
From there wizard should be self-explanatory and easy to navigate. You choose your CSV as source, desired destination, configure columns and run the package.
If you need detailed guidance, there are plenty of guides online, here is a nice one: http://www.mssqltips.com/sqlservertutorial/203/simple-way-to-import-data-into-sql-server/