Reputation: 567
I want to get a string starts with @
from full text.
My text is:
" Hello this is @jancooth from paradise"
I only want to get the @jancooth
part.
Upvotes: 0
Views: 670
Reputation: 1261
CHARINDEX
with SUBSTRINGs
will work for you, assuming there is only one instance of @
.
declare @testtext NVARCHAR(50) = 'Hello this is @jancooth from paradise'
select substring(@testtext,charindex('@',@testtext), charindex(' ',@testtext,charindex('@',@testtext)) - charindex('@',@testtext))
Upvotes: 1