Answers for "fetch second word from a string in ms sql"

SQL
0

fetch second word from a string in ms sql

-- 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;
Posted by: Guest on April-22-2021

Code answers related to "fetch second word from a string in ms sql"

Code answers related to "SQL"

Browse Popular Code Answers by Language