Updated on Kisan Patel
This tutorial will show you how to get a part of string from a sentence in SQL Server?
To get part of string from a sentence, we can use SUBSTRING
function. It accepts three parameter
DECLARE @myName varchar(50) SET @myName = 'csharpcode Services LLP' SELECT @myName, SUBSTRING(@myName, 4, LEN(@myName)), SUBSTRING(@myName, 12, LEN(@myName))
Here in above query, the first column will give us the complete string, the second will give us all the string starting from 4th position, the third column will give us string starting from 12th position in the whole string.