SQL SELECT everything after a certain character

前端 未结 6 1988
广开言路
广开言路 2021-01-31 16:02

I need to extract everything after the last \'=\' (http://www.domain.com?query=blablabla - > blablabla) but this query returns the entire strings. Where did I go wrong in here:<

6条回答
  •  迷失自我
    2021-01-31 16:13

    For SQL Management studio I used a variation of BWS' answer. This gets the data to the right of '=', or NULL if the symbol doesn't exist:

       CASE WHEN (RIGHT(supplier_reference, CASE WHEN (CHARINDEX('=',supplier_reference,0)) = 0 THEN
        0 ELSE CHARINDEX('=', supplier_reference) -1 END)) <> '' THEN (RIGHT(supplier_reference, CASE WHEN (CHARINDEX('=',supplier_reference,0)) = 0 THEN
        0 ELSE CHARINDEX('=', supplier_reference) -1 END)) ELSE NULL END
    

提交回复
热议问题