isle chow isle chow - 6 months ago 13
SQL Question

Removing Special character from string sql

my table have column contain data like this.

SQL 2008

97W
125/ 122Q
121/ 118Q
121/ 118S
123/ 120S
112H
111H


i am trying to remove data before / so output will look like as

97W
122Q
118Q
118S
120S
112H
111H


can anyone share experience how can i achieve if came across such scenario.

Thanks,

Answer

Try this:

SELECT LTRIM(RIGHT(mycol, LEN(mycol) - CHARINDEX('/', mycol)))
FROM mytable

Demo here