when doing the system or project, often encounter such requirements: the user sent us some data, asked us to import this data into the number of
According to the library, for a small amount of data, with the most primitive method can be solved, directly in the SQL with statements to achieve, but if there are thousands of
What about the data? If you continue to write SQL statements alone, it is estimated that you will have the impulse to jump from a dozens of article, there are two simple ways:
1, the Excel data collation, through the import function of SQL directly into the database, but to ensure that the database field and Excel fields consistent.
2. Generate the appropriate SQL statement from Excel and then put it into a new SQL query and execute it. Here's how to use this method:
We want to import the following 20 data into the database, a single insert, too slow, I am a lazy person, want to lazy, can only think of other law son.
In Excel's E1 cell, write a SQL statement that you can simply write:
INSERT into TableName (column1,column2,column3) VALUES (' Value1 ', ' Value2 ', ' Value3 ')
Then directly from the beginning to the end, you will find all the data have a corresponding script, and then directly copy the relevant SQL statements, into the parser, F5,ok, the task is complete!
A little experience, and share with you, it is a time to share, to share with each other, help each other and improve together.
I'll teach you-----. Using Excel to generate SQL statements in batches, processing large amounts of data