This article is a mirror article of machine translation, please click here to jump to the original article.

View: 10808|Reply: 0

[Source] Import the txt file to SQL SERVER 2008

[Copy link]
Posted on 2/4/2015 2:38:28 PM | | | |

Recently, I was studying databases and wanted to try to process a large amount of data. Manual entry of large amounts of data is not possible anymore, so import is required. I read a lot of tutorials on the Internet, and then downloaded 10,000 lottery lottery records in txt format. But importing this data into SQL Server 2008 still took a day and a half. The tutorials I found online have never solved the problems I encountered during the import process. Write this blog for reference! The following is an illustration of the import steps, and finally the precautions. (This blog is only useful for rookies)

       In the first step, open the Import and Export tool. (Win7 comes with SQL on 32-bit systems, and it seems to be installed on 64-bit systems)

      

      Step 2: Choose the format of the source file. Here the txt format file selects the flat file source.

       The third step is to browse and select the file source, where the code page should be changed to Chinese Simplified. In addition, you can check whether the imported data columns are correct in Columns, and you can edit the field names in Advanced.

          Step 4: Select the target server and database. It is to determine which database of a server to import the data file to.

           Step 5: Select the target table and open the edit map. By default, create a new table with the file name.

        Step 6, edit the map. Import data mapping into each field of the database! If the target table is newly created, edit the field names and data types in the database.

         Then after doing this, as long as there is no problem with the data source, click Next...... You can do it.

        Now let's talk about what to look out for when importing data. When importing files in txt format, you first need to pay attention to the arrangement of data. Each column is separated by a uniform separator to remove extraneous row information. It should also be noted that spaces are also read when importing files in txt format, so remove spaces. In fact, the only problem I encountered when importing it stuck me for a day and a half. The data are arranged according to the requirements as shown in the figure:






Previous:Add characters in bulk before each line in a txt text file
Next:High Availability in SQL Server (1) ---- an overview of high availability
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com