Checking a string in SP | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Checking a string in SP

Hi All, I have a question for you guys. I take a string as a parameter into my SP.
Now I want to check, within the SP, if that string contains ‘ADVANCE’.
How do I check that ? eg: exec temp_stoproc ‘i have advanced to the next level’ In the If statement within the SP I want to check if this string contains advance or not.
i have advanced to the next level
Could you guys help me out…
Sitanshu Gupta
Hi You can try using CHARINDEX or PATINDEX.Details about these are available in BOL. cheers
Parik****
If String like ‘%advance%’ then
— If stuff
else
— else stuff Madhivanan Failing to plan is Planning to fail
]]>