How to escape a string for use with the LIKE operator in SQL Server?

后端 未结 7 1405
半阙折子戏
半阙折子戏 2020-12-15 07:59

I am looking for something that works in SQL Server similar to the @ symbol in c# which causes a string to be taken as it\'s literal. Eg:

strin         


        
7条回答
  •  借酒劲吻你
    2020-12-15 08:42

    Each character to be treated literally should be enclosed in square brackets. A right bracket is taken literally directly so don't enclose that one.

提交回复
热议问题