Getting the Last Word from a Sentence in a given String using Sql Server.

vishalneeraj-24503
Posted by vishalneeraj-24503 under Sql Server category on | Points: 40 | Views : 416
Write below Query:-
DECLARE @Sentence VARCHAR(100) = 'Dot Net funda is a good site';
SELECT REVERSE(LEFT(REVERSE(@Sentence),
CHARINDEX(' ',REVERSE(@Sentence))- 1)) AS [Last_Word]


Output:-
site

Comments or Responses

Login to post response