Search value in column which is pipe separated in sql

Irs*_*had 4 sql t-sql sql-server sql-server-2008

I want to search value which is pipe-separated in column. See below.

Column1 
1
1|2|23
2
6
6|12
Run Code Online (Sandbox Code Playgroud)

I want to search 2 in all rows so it will return below rows

Column1
1|2|23
2
Run Code Online (Sandbox Code Playgroud)

Can anyone please tell me how can we achieve this?

Gor*_*off 6

你可以使用like:

where '|'+column1+'|' like '%|2|%'
Run Code Online (Sandbox Code Playgroud)

通过包含额外的分隔符,您可以避免"2"匹配"23".