Thursday, January 7, 2016

Get the numeric from string in SQL

declare @st varchar(50) ='Mahesh999666777555'

select PatIndex('%[0-9]%',@st)

select substring(@st,PATINDEX('%[0-9]%', @st),len(@st)) GetNumber

No comments: