Using like over charindex to search for pattern

  • We where using charindex to search for a string as shown below

    SELECT *

    FROM tablename

    WHERE ( Charindex('47a%$.abc',CAST(columnname AS VARCHAR(MAX)))>0 )

    I am planning to replace charindex with LIKE as i require to search only whether the pattern exists not the position.

    So i want to know is these any disadvantage in using LIKE over charindex for my case.I am using charindex in several cases. So i want it to work for all sql datatypes ,all characters including special characters(including % (as like already uses %pattern%).So please tell me is there any disadvantage in using like over charindex

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply