sql server - SQL : Retrieve ID stored in a string -


i bit lost how retrieve id. have stored inside string like

hi interested in sharing apartment or rent rooms please text me {propertyid:43499}

the part want 43499

how can achieve in sql-server.

the solution worked me, edited answer got kavin chakaravarthi

declare @string nvarchar(max) set @string = 'hi interested in sharing apartment or rent rooms please text me {propertyid:43499}' select substring(substring(@string, charindex(':',@string) +1, datalength(@string)), 0,6)` 

using sql query u can seperate id:

 declare @id varchar(max)='hi interested in sharing apartment or rent rooms please text me {propertyid:43499}'  select @id=stuff(@id,len(@id),1,'')  select @id=substring(@id,charindex(':',@id)+1,len(@id))  select @id 

output:

 id 43499 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -