How to import a CSV file into a database using SQL Server Management Studio
While bulk copy and other bulk import options are not available on the SQL servers, you can import a CSV formatted file into your database using SQL Server Management Studio.
First, create a table in your database into which you will import the CSV file. After the table is created:
- Log in to your database using SQL Server Management Studio.
- Right click the database and select Tasks -> Import Data…
- Click the Next > button.
- For Data Source, select Flat File Source. Then use the Browse button to select the CSV file. Spend some time configuring the data import before clicking the Next > button.
- For Destination, select the correct database provider (e.g. for SQL Server 2012, you can use SQL Server Native Client 11.0). Enter the Server name; check Use SQL Server Authentication, enter the User name, Password, and Database before clicking the Next >button.
- In the Select Source Tables and Views window, you can Edit Mappings before clicking the Next > button.
- Check Run immediately and click the Next > button.
- Click the Finish button to run the package.