'How to replace starting two digit (00) with blank space in T-SQL?

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.



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 C J