Search code examples
sqlsql-serverstring-function

Trying to Split a String Into Parts by SQL Query


Please Excuse me if this is Simple... I am new to SQL..I am need to Run this Custom SQL Query to get data from Microsoft SQL Server. Here is this field

TitleName

abc_34235
abcd_2_56543
xyz_4532

I want to get a Column with Only these Values

34235
56543
4532

Please Help DR


Solution

  • I think this can help you:

    select RIGHT(TitleName,LEN(TitleName)-CHARINDEX('_',TitleName)) from Mytable