A regular master, such a replacement can be achieved?

Source: Internet
Author: User
The existing SQL statements are as follows:
INSERT into Test (A, B) values (' $A ', ' $B ')
Update test set a= ' $A ' where b= ' $B '
Because of the multi-language problem, you now need to replace the SQL statement with the following:
INSERT into Test (A, b) VALUES (n ' $A ', n ' $B ')
Update test set a=n ' $A ' where b=n ' $B '

Can I use a regular replacement in a text editor (Phpdesigner 8,notepad++,editplus) to achieve bulk substitution?
Because the document is too much, really can't afford to change
Ask God for help





Reply to discussion (solution)

Can you change the type of the field?
NVARCHAR Change to VARCHAR

Regular replacement of PHP
$txt = Preg_replace ("/' \$\w/", ' n$0 ', $txt);

The existing SQL statements are as follows:
INSERT into Test (A, B) values (' $A ', ' $B ')
Update test set a= ' $A ' where b= ' $B '
Because of the multi-language problem, you now need to replace the SQL statement with the following:
INSERT into Test (A, b) VALUES (n ' $A ', n ' $B ')
Update test set a=n ' $A ' where b=n ' $B '

Can I use a regular replacement in a text editor (Phpdesigner 8,notepad++,editplus) to achieve bulk substitution?
Because the document is too much, really can't afford to change
Ask God for help



Well, it would have been varchar before, but later because of the German-language relationship, if it was varchar, the storage in the database would become? , so only modified the database type is nvarchar, but in this case the SQL must be added N in order to have no problem, so I want to find some way to replace the code in bulk

Can you change the type of the field?
NVARCHAR Change to VARCHAR

Regular replacement of PHP
$txt = Preg_replace ("/' \$\w/", ' n$0 ', $txt);


Well, it would have been varchar before, but later because of the German-language relationship, if it was varchar, the storage in the database would become? , so only modified the database type is nvarchar, but in this case the SQL must be added N in order to have no problem, so I want to find some way to replace the code in bulk

I solved it myself.

  • 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.