Codementor Events

How to import data from CSV file to SQL SERVER 2012 and Old version

Published Apr 24, 2021Last updated Apr 25, 2021
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 1.jpg

STEP-2
a new window will appear after that ,see the below image.
step 2.jpg
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 3.jpg

STEP-4
from the datasource select the 'FLAT FILE SOURCE'. and then click on browser from below dropdown.
step 4.jpg

STEP-5
From the open file dialoge window ,select CSv file as shown below.
step 5.jpg

STEP-6
You will see this window after that and click 'Next' to proceed.
step 6.jpg

STEP-7
Select this required check box 'Run Immediately'.to go for next step.
step 7.jpg
STEP-8
Default action list, nothing change here.
step 8.jpg

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.
ste p9.jpg

STEP-10
Here is the report list for whole process taken by the sql server.
step 10.jpg

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.

😃

Discover and read more posts from Rizwan
get started
post commentsBe the first to share your opinion
Show more replies