Use the regular expression "sqlserver" to find and replace "and the wildcard Function

Source: Internet
Author: User

 

[Use regular expression]

I want to review the table creation script (DDL) of the database to the DBA. First, it is generated to a new query window. Then, it is necessary to clear many useless items such as "go" in the automatically generated text, but also remove the line break, it is like the following script:

Exec sys. sp_addextendedproperty @ name = n' MS _ description', @ value = n' wave id', @ level0type = n' schema ', @ level0name = n' dbo ', @ level1type = n' table ', @ level1name = n' basemonitorbatch', @ level2type = n' column', @ level2name = n' batchid'
Go
Exec sys. sp_addextendedproperty @ name = n'ms _ description', @ value = n'boundary encoding ', @ level0type = n'scheme', @ level0name = n'dbo ', @ level1type = n' table ', @ level1name = n' basemonitorbatch', @ level2type = n' column', @ level2name = n' batchcode'
Go

In this case, we need to use a regular expression. Paste a picture. You can see it at a Glance:

With this method, you can also clear "set ansi_padding off \ NGO" and so on:

[Use wildcards]

Because ibatis is used, to extract the SQL definition segments, you can change your mind and replace them with wildcards, remove the label similar to <select id = "getsendpaycount2" resultclass = "int">:

 

[Summary]

The above method saves a lot of time and improves your work efficiency. Similar functions are available in Visual Studio.

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.