Delimiter in the sample string i chose is # .
Script gets string between two #s.
Delimiter in the sample string i chose is # .
Script gets string between two #s.
DECLARE @sampleString VARCHAR(1000) = '#This is a sample string# between two delimiters'DECLARE @sampleString VARCHAR(1000) = '#This is a sample string# between two delimiters' SELECT Substring(@sampleString, ( Patindex('%#%', @sampleString) + 1 ), ( ( Len(@sampleString) - ( Patindex('%#%', Reverse(@sampleString)) ) + 1 ) - ( Patindex('%#%', @sampleString) + 1 ) ))