Use the notepad++ recording macro feature to quickly add the SQL search condition to the front and back single quotes _mssql

Source: Internet
Author: User

When we have a lot of pens to search for in the library, we often use the following syntax

 SELECT
 *
 from member
 WHERE
 accunt to
 (
 ' Tom ',
 ' John ', ' may
 '
 )

In the search terms in the above language, there are three account items of Tom, John, may, and less information, you can also add a single citation to the front of the account and a funny number on the back, but when you have a case of 50 accounts, it's going to take a lot of time to enter a pen.
I used to use the CONCATENATE function in Excel to deal with this kind of information, but one day my colleague taught me that I could do this with the notepad++ of the big set.

I think this is a faster way than Excel, so share it here

1. Paste the search for processing to notepad++, and here's a picture of 25 (the English name in the picture is from Google random search)

2. Because the macro is the record of your operations, you first move the cursor to the beginning of the first data, and then press the macro button on the Notepad++ tool list to start recording

3. Because the cursor is already at the very beginning, the first data position, so please use the keyboard directly, according to the following key to the key in order to enter (in the bottom of the key is the key button OH)

"'"→"end"→"'"→","→"↓"→"home"

4. After the third step, it should become the same as the following image, the first search for the item has been added to the front and back of the symbol and the last.

5. Confirm that Step 4 is complete, click the button below to stop recording the macro

6. After the recording, the remaining 24 data can be used to deal with the macro, run a try to see whether it is normal

Click the Click button to play the macro (Rang at the beginning of the second data)

7. After playing the macro, you can see that the second data is also handled, and the cursor moves to the beginning of the third.

8. The experience of the huge set of questions, then take a breath and let the macro perform the last piece of information.

Click the button in step 1 to repeat the macro, and then in the Cue window, select "Execute to File End" and press execute.

9. After the completion, you can see that all the conditions are added to the front and back of the symbol and the signal, just to note that the last piece of the search, the last one will have a funny symbol

Remember to delete the tag and then paste it into SQL, otherwise the inquiry will fail!

(After completion, the windows of a duplicate macro will not be automatically closed, and you can cancel it)

10. The requirements have been achieved by completing the above steps, but if you turn off notepad++, the next time you're in the same situation, you'll have to record the huge set again.

Luckily notepad++ has the ability to save macros, so we can put this great collection down and we can use it next time.

Click the button in step 1 to open the Macro storage window, take a name for this macro in the "name" input, and press the "ok" button when you're done.

11. When you turn off the notepad++ and then open it up again and paste the unhandled information in the click of the "repeat a single macro" button, you can select the huge set we just saved in the window.

Select the macro that you just saved, and then select Execute to the end of the file and press execute, and you can see the results of the processing with step 91.

Related Article

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.