How to import data from CSV file to SQL SERVER 2012 and Old version
I am writing this article because i didn't see any article with huge explanation
related to this concept.
these below steps are pretty much same for all new version of SQL server after 2012 but with minor user interface changes.
Reason for writing this Blog:
Mostly developer makes the application that will read the data from the CSV file
and uplaoding it to the database with bunch of lines of code in C# or any other programming language.
we don't need to write other utilities to import the data into Database,
Microsoft Visual studio has its own hidden feature, that will help you to easily import any kind of File ,like CSV, Excel ,TXT, Etc..
CSV
The most common files extension using in these days is CSV file extension.
Mostly data transfering in this format, like shopify, Ali express, Amazon, most of the sites supporting this format with millions of data exporting options.
Because it easy to mentain, export and import in both context for users and for companies as well.
I will upload the CSV file, with some data to my sql server 2012, that i have already installed on my system.
I will explain each steps with screen shots below.
STEP-1:
Create a database in SQL server,
right click on it => Task => Import Data
STEP-2
a new window will appear after that ,see the below image.
Press 'NEXT' for next step.
STEP-3
After that you have to select the Data source from the dropdown.
and select the server name if you want to upload the data to your remote database,
and i am going with default, window authentication.
STEP-4
from the datasource select the 'FLAT FILE SOURCE'. and then click on browser from below dropdown.
STEP-5
From the open file dialoge window ,select CSv file as shown below.
STEP-6
You will see this window after that and click 'Next' to proceed.
STEP-7
Select this required check box 'Run Immediately'.to go for next step.
STEP-8
Default action list, nothing change here.
STEP-9
When you click on FINISH button, application will copy all the data from your CSV file to your database.
like below images,
Make sure you haven't open the CSV file on your system.
STEP-10
Here is the report list for whole process taken by the sql server.
I Hope this article helped you alot.
Thank you Very much for your support,
Please mention in comment ,if there is any question related to this,Or any questions.