Skip to content
Home ยป Import file in SQL server

Import file in SQL server

Import csv file in SQL Server database table




Using SQL Server Management Studio, you can easily import file data in SQL Server database.

As you can see, here we have one CSV file named as Data.CSV.

 

This file is located inside system Folder Inputfile.

 

 

 

 

Now we will import this file data into SQL Server data base(version 2019) table.

Following are the step to load csv file data into sql server table.

1> Right click on database where you want to load file data >Then, Click on Tasks context menu > Next, Import Flat File ( This option is for .CSV ,orย  .txt format files)

 

After that you will see , an introduction pop window opens.

2> Click on, Specify input file > Choose file that you want to load in table> Specify table name, we have taken InputDatFile and choose schema. This table will be used to load input file data.

After that click on NEXT button.

 

 

3> Now preview data window opens, here you can see sample of data, so that you can validate that you have choose correct file or how does your data look like in tabular format.

After that click on NEXT button.

 

4> Once you click on NEXT button, a Modify columns window open , here you can make changes in column data type ,set primary key columns so on.. as per your requirement.

Once you done with that , click on NEXT button.

 

[Also Read: SQL Server Bulk Insert(BCP)]

5> After that , it displays you summary of you inputs like input file names, database name and table name just to validate that you have chosen right file or not .

After that just click on FINISH button to complete final step.

 

 

Once you click on finish button, it starts loading file data into table. When loading is completed,

You will get a success message in dialog box.

 

Now you can check whether the records is inserted or not in table that you have given.

SELECT * FROM InputDataFile

As you can see, now you have imported CSV file data into SQL table,ย  and table having same records as you had in your input file.




Also Read..

SQL Server Bulk Insert(BCP)

Copy or Delete files from directory in SQL Server

SQL Basics TutorialSQL Advance TutorialSSRSInterview Q & A
SQL Create tableSQL Server Stored ProcedureCreate a New SSRS Project List Of SQL Server basics to Advance Level Interview Q & A
SQL ALTER TABLESQL Server MergeCreate a Shared Data Source in SSRSSQL Server Question & Answer Quiz
SQL DropSQL Server PivotCreate a SSRS Tabular Report / Detail Report
..... More.... More....More
Power BI TutorialAzure TutorialPython TutorialSQL Server Tips & Tricks
Download and Install Power BI DesktopCreate an Azure storage accountLearn Python & ML Step by stepEnable Dark theme in SQL Server Management studio
Connect Power BI to SQL ServerUpload files to Azure storage containerSQL Server Template Explorer
Create Report ToolTip Pages in Power BICreate Azure SQL Database ServerDisplaying line numbers in Query Editor Window
....More....More....More




 1,901 total views,  1 views today

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.