Home > Software engineering >  How to replace starting two digit (00) with blank space in T-SQL?
How to replace starting two digit (00) with blank space in T-SQL?

Time:05-17

I have a table where as codes are present in the form of 78,7244,d345 by default few records are found where the codes are start with 0072 .

I have to delete starting two number (00) from all codes wherever its present in column.

CodePudding user response:

You could test for it like:

select 
    case 
        when code like '00%' 
        then right(code,len(code)-2) 
        else code end AS Code
from YourTable
  • Related