Extracting numeric part from string - SYBASE ASE -
i trying extract 7658 string xyz.abc7658@yahoo.co.in
. below query trying , output shown. query doesn't server purpose.
can please on this? (running query on sybase ase)
select substring('xyz.abc7658@yahoo.co.in', patindex('%[0-9]%', 'xyz.abc7658@yahoo.co.in'), len('xyz.abc7658@yahoo.co.in')) number go number -------------- 85@yahoo.co.in
you did not mention end poistion
declare @str varchar(100) select @str='xyz.abc7658@yahoo.co.in' select substring(@str, patindex('%[^0-9][0-9]%', @str) + 1, patindex('%[0-9][^0-9]%', @str) - patindex('%[^0-9][0-9]%', @str))
Comments
Post a Comment