How to escape parenthesis in SQL query?
Using Microsoft SQL Server 2005 - wondering how can I escape parenthesis in my query?
I'm trying to find the string position of "(" in one of my columns returned, but Management Studio keeps thinking I'm opening another command when I use that. I've tried \ but that 开发者_如何学Pythonisn't escaping it.
Thank you!
this doesn't work for you?
select charindex('(', yourColumn)
from yourTable
You don't need to escape it, see example below:
select charindex('(', x)
from (
select 'asdasda(adsadas' as x
) a
Output:
8
select charindex('(',<columnname>) from <tableName>
精彩评论