Skip to content

Instantly share code, notes, and snippets.

@alexaleluia12
Created February 6, 2017 15:11
Show Gist options
  • Save alexaleluia12/103448601ecee1e70fcaeafdd11a3c92 to your computer and use it in GitHub Desktop.
Save alexaleluia12/103448601ecee1e70fcaeafdd11a3c92 to your computer and use it in GitHub Desktop.
zero na frente do cnpj
-- cnpj valido tem tamanho 14
-- usar as funcoes length e concat
--
UPDATE `cliente` ta,
(SELECT cnpj, id from `cliente` where length(cnpj) = 13) tb
SET ta.cnpj = concat('0', tb.cnpj)
where ta.id = tb.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment