You are currently viewing How to Import Data From Text File to SQL Table

How to Import Data From Text File to SQL Table

How to Import Data From Text File to SQL Table

In this post, we will import data from text file to SQL Server table using SQL Server Import and Export Wizard.

Step-I: Open SQL Server Management Studio and Connect to SQL Instance by clicking on Connect button as shown in the following figure.

Step-II: Right-click on the database(NORTHWIND in this demo) where you want to import table data, move cursor to Tasks and Click on the Import Data…

Step-III: To Select the source from the which to copy data window

  • Select the Data Source Flat File Source from the drop-down.
  • Browse the File name which contains the data.
  • Format should be Delimited Selected.
  • Header row delimiter should be {CR}{LF} selected.
  • Check the checkbox Column names in the first data row.
  • Click on Next button.

Step-IV: 

  • Select the Destination SQL Server Native Client 11.0 from the drop-down list.
  • Select Server name.
  • Check Authentication, Use Windows Authentication or Use SQL Server Authentication radio button.
  • Choose Database from the drop-down where you want to copy data.
  • Click on Next button.

Step-IV: In the below window there are two tabs, In the first tab there will be source file name along with source path, and in the Destination table there will only be a file name as table name. You can specify different name for table under destination tab. In my case, table name generated as Customers, but I changed it to tblCustomers.

Step-V: Click on Next with default checkbox.

Step-VI: Click on Finish button.

Step-VII: Process executed and gives a success message along with number of rows inserted. Close the window.

Step-VIII: 

  • Click on Close button to close the SQL Server Import and Export Wizard.
  • Check your database where you imported the table.

Buy Best Stationery Products in Pakistan

Piano Ballpoint Pen

Piano Ballpoint Pen

ORO Trimetal Pencil

ORO Trimetal

Dollar Clipper Pen

UHU 10×7 ml Pack of 10 PCs

UHU 10×7 ml Pack of 10 PCs

Glue Stick 8g Pack Of 12 PCs

Glue Stick 8g

Color Pencils Box of 12 PCs

Deer Multi Color Pencils

Leave a Reply