The below sql statement is not resulting any records.
Declare @sSelectedStates as nvarchar(500) = REPLACE('Bihar|Gujarat|Jharkhand','|',''',''')
select * from MyTable where State IN (@sSelectedStates)
This works
Declare @sSelectedStates as nvarchar(500) = REPLACE('Bihar','|',''',''')
select * from MyTable where State IN (@sSelectedStates)
This also works
Declare @sSelectedStates as nvarchar(500) = REPLACE('Gujarat','|',''',''')
select * from MyTable where State IN (@sSelectedStates)
What I am doing wrong?
Using the below statement I changed the database compatibility level
ALTER DATABASE DatabaseName SET COMPATIBILITY_LEVEL = 130