SQLTeam.com | Weblogs | Forums

Get numer value from cell to update anouther cell

sql2012

#1

Hello

I have a table that has a cell (named: wo) and the data looks like PM12345 or 12345 - what i would like to be able to do is take the data (as above) and update another cell (same table) with the first numeric value '1' and add a '0' to the front of it; so it would look like '01';


#2
update my table
set othercell = case
    when wo like '[a-z][a-z]%' then '0' + substring(wo, 3, 1)
    else '0' + left(wo,1)
end

#3

Thank you so much ...