Two ways to import data from an Excel table into a SQL database _mssql

Source: Internet
Author: User

Originally in the research of micro-trust public platform, the eldest brother temporarily hand me a task, the Excel table data into the SQL database, I think this so easy. I didn't want to spend two days on it.

Introduction: A table with the following structure in the database (table a)

I only take the key and the column has a lot of data.

There is an Excel file (table B) with ID and name control, and N-structure-like table (c table) (no ID that column)

My task in B table found in the C table of the corresponding ID, and then add ID to C table, and finally, according to the ID is unique, with C table data to update a table data. This mainly involves the transformation between Excel tables and database tables.

Solution One: Use Excel+mysql for Excel to handle

is MySQL for Excel is a direct operation of Excel MySQL database plug-ins, you can modify the database like the Excel table, of course, you can also do table merging and so on. Plug-in installation, everyone Baidu Bar.

A problem was encountered when using this, MySQL for Excel can connect to the local database, but the database on the server is always not connected .... Programme one bankrupt

Scenario Two: Import the Excel table directly into the database and use the SQL statement to do the operation.

Notice here that 2.1 is the phone number in the Excel form to be formatted as text, and the second is to unify the traditional characters. When the space is garbled, remove the space to rewrite the input.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.