In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article shows you how to import data in bulk in MySQL, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
How to realize MySQL bulk Import data Operation
Taking the MySQL database as an example, we will introduce how to import all the data of a table or the data of a specified field into the target table through the SQL command line. This method also applies to SQLServer databases, that is, T-SQL.
Category 1. If the fields of two tables (export table and target table) are the same, and you want to insert all the data, you can use this method: (this method is only suitable for exporting two tables on the same database)
INSERTINTO
Target table
SELECT*FROM
Source table
For example, to insert an articles table into an newArticles table, you can do this with the following SQL statement:
INSERTINTO
NewArticles
SELECT*FROM
Articles
How to realize MySQL bulk Import data Operation
Category 2. If you only want to import the specified fields, you can use this method:
INSERTINTO
Target table (field 1, field 2, etc.)
SELECT
Field 1, field 2.
FROM
Source table
Please note that the fields of the above two tables must be the same (field type), otherwise a data conversion error will occur.
1. Copy the data in the table across servers
Insertintoopenrowset ('sqloledb','localhost';'sa';'123',Test.dbo.Table_B) select*fromTest.dbo.Table_A// enable AdHocDistributedQueries:execsp_configure'showadvancedoptions',1reconfigureexecsp_configure'AdHocDistributedQueries',1reconfigure// after you finish using it, turn off AdHocDistributedQueries:execsp_configure'AdHocDistributedQueries',0reconfigureexecsp_configure'showadvancedoptions',0reconfigure
2 、
/ / No cross-server insertintodbo.Table_B) select*fromdbo.Table_A
Concatenate the table name and the database connection string in code and then execute the sql statement program functions you need above.
The above is how to import data in bulk in MySQL. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.