sql - substring varchar get first globalid -


i have varchar string , need return first globalid value - 8679926300927194610 string:

 declare @erservice varchar(max) = 'globalid=8679926300927194610,ou=services,globalid=00000000000000000000' 

you can following. assuming string starts globalid=, , there comma after number.

select substring(@erservice,10,charindex(',',@erservice)-10) 

Comments

Popular posts from this blog

c# - HttpResponseMessage System.InvalidOperationException -

sql - Postgresql error: "failed to find conversion function from unknown to text" -