Find any letter in a string SQL Server 2008 R2 -
i have string contains number , letter combination. 1a , 10c, 15a etc. have case statement applies relative value number based on number , letter combination. statement looks this:
when [page] '%[a-z]' left([page],1)+((ascii(convert(varchar,(right([page],1))))-64)*.01)
this works great when page number portion less 10 in case of 1a when @ 10c , 15a, should 10.02 , 15.01 respectively. want use charindex find [a-z] in left's length factor.
has done this?
when [page] '[0-9][a-z]' left([page],1)+((ascii(convert(varchar,(right([page],1))))-64)*.01) when [page] '[0-9][0-9][a-z]' left([page],2)+((ascii(convert(varchar,(right([page],1))))-64)*.01) when [page] '[0-9][0-9][0-9][a-z]' left([page],3)+((ascii(convert(varchar,(right([page],1))))-64)*.01)
etc
Comments
Post a Comment