Wednesday, March 31, 2010

Getting Integer value from Varchar Column

Declare @str varchar(20)
Set @str = 'SARAN01'
select Substring(@str,PATINDEX('%[0-9]%',@str),len(@str))

OUTPUT
-------
01

No comments:

Post a Comment