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

View: 14213|Reply: 0

[Source] SQL Server exports the specified data with conditions

[Copy link]
Posted on 12/4/2017 4:31:47 PM | | | |
Today I exported a few pieces of data with SQL Server, and then inserted them into my machine, when the test data was used, at the beginning, export the CSV format file, and then, import from my computer, there are various errors, because there is a field in my database that stores data that is divided by commas, so it may be caused by this reason


I just need the data in this field, I can't do it, right-click, task, generate script, export the data of the entire table is 100m, but the data I need is only about 20, which is only about a few tens of kb,




Since I can export the data of the entire table, I can directly generate a table with the required data, the steps are as follows:

First, the SQL statement is as follows:




Then, a test1 table will be generated, which already contains the data we need, and then export the test1 table as follows:


After exporting it into a sql file, replace [test1] with the table name we need, as follows:





After the replacement is completed, copy the SQL statement and go to my native SQL analysis queryer, as follows, just execute! Successfully exported and inserted into my local database!






Previous:Unboxing picture of Yunfan traffic treasure box
Next:javascrip{filter}t performance optimization
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