remove zeros sql [closed]

2

I have a EUW0 field 10598260, and needed to be EUW 1598260

I need to remove a specific field

SQL:

SELECT 'EUW' + substring(campo,patindex('%[^EUW0 ]%',campo + ' ')
       ,len(campo)) AS campo1
       ,campo2
  FROM [tabela]
 WHERE campo3 = 'cp'
   AND campo LIKE '%EUW0%'
    
asked by anonymous 15.01.2016 / 12:59

1 answer

0

You can do this through REGEX:

select REGEXP_REPLACE(campo,'EUW.1.','EUW1') from tabela

So before and after '0' will be discarded.

    
15.01.2016 / 13:15