DEV Community

Cover image for Import file in SQL Server
Clever Cottonmouth
Clever Cottonmouth

Posted on

Import file in SQL Server

Importing a CSV File into SQL Server Database Table

Importing a CSV file into an SQL Server database table is very straightforward using SQL Server Management Studio (SSMS). Here's a step-by-step guide:

Step 1: Prepare the CSV File

Ensure your CSV file (e.g., Data.CSV) is ready for import.

CSV File Example

This file is located in a local folder, e.g., Inputfile.

File Location

Step 2: Open Import Flat File Wizard

  1. In SSMS, right-click on the database where you want to import the file.
  2. Navigate to Tasks > Import Flat File.

Import Flat File Option

Step 3: Introduction Window

An introduction window will appear. Click Next.

Introduction Window

Step 4: Specify Input File

  1. Select the CSV file you want to load.
  2. Specify the table name (e.g., InputDatFile) and schema (e.g., dbo).
  3. Click Next.

Specify Input File

Step 5: Preview Data

The Preview Data window displays a preview of your file's contents. Validate the data, then click Next.

Preview Data

Step 6: Modify Columns

In the Modify Columns window, adjust data types, set primary keys, or make other changes as needed. When finished, click Next.

Modify Columns

Step 7: Review Summary

Review the summary of your inputs, including the file name, database name, and table name, to ensure accuracy.


This completes the process of importing a CSV file into an SQL Server database table.

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

đź‘‹ Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay