Jesper Petersen
Jesper Petersen

Reputation: 7

How do I copy a csv file into a mssql database?

I am looking for help to migrate my mysql over to mssql.

I have taken the database from MySQL and created a .csv file.

But from here I get stuck.

I hope you can help me to understand this.

Upvotes: 0

Views: 134

Answers (2)

jlee-tessik
jlee-tessik

Reputation: 1520

  1. Open Sql Server Management Studio; connect to your server.
  2. Right click your database in Object Explorer, and go to Tasks -> Import Data...
  3. In the wizard that pops up, choose a Data Source of "Flat File Source", and browse to your csv file for File Name.
  4. For Format, choose "Delimited".
  5. For Text Qualifier, type in one double-quote character: ". This is an important step that will let SQL read in strings properly.
  6. Depending on your file, check or un-check the "Column names in the first data row"

For the most part, this will import your file in. You may need to tweak some of the settings under the Advanced section if your data has text > 50 characters or numeric characters, but the Preview section will show you how the file looks so far.

Upvotes: 0

bumble_bee_tuna
bumble_bee_tuna

Reputation: 3563

Using Sql Server Import Wizard

1) Open Sql Server Managment Studio
2) Go Import Wizard.
3) Point the Wizard at your file (I would recommend saving the csv to excel tho).
4) Map Columns to appropriate datatypes and lengths.

Upvotes: 1

Related Questions