Can this replacement be implemented?

Source: Internet
Author: User
Tags php regular expression
Can this replacement be implemented? The existing SQL statement is as follows:
Insert into test (A, B) values ('$ A',' $ B ')
Update test set A = '$ a' where B =' $ B'
Due to the problem of multiple languages, you 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 regular expressions in the text editor (phpDesigner 8, Notepad ++, EditPlus) to replace them in batches?
Because there are too many files to be changed.
Please help me





Reply to discussion (solution)

Can't you change the field type?
Change NVARCHAR to VARCHAR.

Php regular expression replacement
$ Txt = preg_replace ("/'\ $ \ w/", 'n' $ 0', $ txt );

The existing SQL statement is as follows:
Insert into test (A, B) values ('$ A',' $ B ')
Update test set A = '$ a' where B =' $ B'
Due to the problem of multiple languages, you 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 regular expressions in the text editor (phpDesigner 8, Notepad ++, EditPlus) to replace them in batches?
Because there are too many files to be changed.
Please help me



Well, it was originally a varchar, but then, due to the German relationship, if it was a varchar, the in-database storage would become? So I changed the database type to nvarchar, but in this case, N must be added in the SQL statement to ensure it is okay, so I want to find a way to replace the code with regular expressions in batches.

Can't you change the field type?
Change NVARCHAR to VARCHAR.

Php regular expression replacement
$ Txt = preg_replace ("/'\ $ \ w/", 'n' $ 0', $ txt );


Well, it was originally a varchar, but then, due to the German relationship, if it was a varchar, the in-database storage would become? So I changed the database type to nvarchar, but in this case, N must be added in the SQL statement to ensure it is okay, so I want to find a way to replace the code with regular expressions in batches.

I fixed it myself and closed it.

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.