For example, you can use
Use mydatabase
Select * from table1 where username like '% c %"
The following is another way to complete the above functions:
Use mydatabase
Select * from table1 where charindex ('C', username)> 0
In theory, this method has one more judgment statement than the previous method, that is,> 0, but this judgment process is the fastest. I want to believe that more than 80% of the operations are spent searching for words.
Character string and other operations, so it is no big deal to use the charindex function. This method also has advantages, that is, %, | cannot be used directly with like
The searched characters can be used directly in this charindex, as shown below:
Use mydatabase
Select * from table1 where charindex ('%', username)> 0
You can also write it as follows:
Use mydatabase
Select * from table1 where charindex (char (37), username)> 0
ASCII characters are %