Fetch Second Word From A String In Ms Sql

[Solved] Fetch Second Word From A String In Ms Sql | Vb - Code Explorer | yomemimo.com
Question : fetch second word from a string in ms sql

Answered by : sergey-rajunets

-- Example there is a column FULL_NAME which contains two words like "Bob Dylan"
-- To fetch second word "Dylan" we will use space as a divisor
-- and take 10 signs after space
SELECT SUBSTRING(FULL_NAME, (SELECT CHARINDEX(' ', FULL_NAME)+1), 10)
FROM TABLE_NAME;

Source : | Last Update : Thu, 29 Apr 21

Answers related to fetch second word from a string in ms sql

Code Explorer Popular Question For Vb