Importing .csv files to SQL server
In this I post I will try to demonstrate how we import a .csv file which we downloaded from online to SQL Server.We use the table which we import to do some other SQL practices in the next topics.
We start by creating a database called 'Nobel_Laureates'. Open SQL Server Management Studio and create a new query window by clicking on 'New Query' menu or by hitting 'Ctrl + N' on your keyboard.
Lets create a database called 'Nobel_Laureates' using the following code.
CREATE DATABASE Nobel_Laureates
USE Nobel_Laureates
Now lets download the list of all the Nobel Laureates from online using this link, or by copying and pasting 'https://www.aggdata.com/download_sample.php?file=nobel.csv' on your browser.
The link downloads a .csv file with a name 'nobel.csv' on your default downloads folder.
Once the nobel.csv file is downloaded, We import it to our Database as follows. Right click on the 'Nobel_Laureates' database.
Leave everything as it is and click Next.
In this I post I will try to demonstrate how we import a .csv file which we downloaded from online to SQL Server.We use the table which we import to do some other SQL practices in the next topics.
We start by creating a database called 'Nobel_Laureates'. Open SQL Server Management Studio and create a new query window by clicking on 'New Query' menu or by hitting 'Ctrl + N' on your keyboard.
Lets create a database called 'Nobel_Laureates' using the following code.
CREATE DATABASE Nobel_Laureates
USE Nobel_Laureates
Now lets download the list of all the Nobel Laureates from online using this link, or by copying and pasting 'https://www.aggdata.com/download_sample.php?file=nobel.csv' on your browser.
The link downloads a .csv file with a name 'nobel.csv' on your default downloads folder.
Once the nobel.csv file is downloaded, We import it to our Database as follows. Right click on the 'Nobel_Laureates' database.
And go to 'task' and then click on 'import data'.The 'SQL Server Import and Export Wizard' dialogue box pops up.
Read the content and Click Next.
From the Data Source list Select Flat File Sources,click Browse button to select the nobel.csv file from your downloads folder. Leave everything else as it is and click Next.
Leave everything as it is and click Next.
Leave everything as it is and click Finish.
Now You have the 'nobel' table in your database.
No comments:
Post a Comment