I have one table where I want to find out the last name from full Name. For Example-
Ramesh Kumar Singh
Mahesh Pratam Thakur
Dheeraj Mani Tripathi
Our answer should be following in the result-
i believe below is the correct answer.
Rakesh Sharma 23 Sep 2018 1 0
SELECT SUBSTRING(fullname, 1, CHARINDEX(' ', fullname) - 1) AS Firstname, SUBSTRING(fullname, CHARINDEX(' ', fullname) + 1, LEN(fullname) - CHARINDEX(' ', fullname)) AS Lastname FROM yourTable