SQL Server: any equivalent of strpos()?

后端 未结 3 1247
失恋的感觉
失恋的感觉 2020-12-16 12:31

I\'m dealing with an annoying database where one field contains what really should be stored two separate fields. So the column is stored something like \"The first string~

3条回答
  •  再見小時候
    2020-12-16 13:24

    The PatIndex function should give you the location of the pattern as a part of a string.

    PATINDEX ( '%pattern%' , expression )
    

    http://msdn.microsoft.com/en-us/library/ms188395.aspx

提交回复
热议问题