SQL Server SQL statements contain parentheses.

Source: Internet
Author: User

The cpu occupied immediately when my company's servers were deployed (I thought the machine was too bad), and it was very loud. I'm really upset.

I can debug the server program. So I will first look at the logs of the tomcat server. It indicates that the server immediately rings when a method is called at a time.

Then I will block this method first... Check the server response. Sure enough, the cpu will not be full immediately. (Can be said to work normally ).

Then I start debugging this method.

I initially thought it was a problem with SQL writing. I wanted to write it again. Later, the manager said that SQL server could use the "Stored Procedure" to solve the SQL efficiency problem.

(Because of my SQL Server database, our manager asked someone to help me write), after a while. The "Stored Procedure" came out. However, the effect is not achieved;

Then I began to rewrite the SQL statement.

Specific SQL: I will not post it.

For example, I want to check the last name in the name field of the "user" table. The old statement is the following SQL statement.

Select * from user where 1 = 1 and name like '% [Li Chen] % ';

Then there is no problem after the query. There is no problem on your own server.

But immediately after arriving at the server, there was a response.

Later I changed it:

Select * from user where 1 = 1 and name like 'Li % 'or name like 'chen % ';

There is no problem. So don't use the symbols in... SQL without understanding them ....

I only know what is wrong with this square brackets... Others will be known later.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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.