Usaremos o comando REPLACE para remover os caracteres especiais, usando a Tabela ASCII para verificar os caracteres, os caracteres removidos no comando serão os seguintes abaixo.

! " # $ % & ' ( ) * + , - . / : ; < = > ? @ ^ _ ] \ [ ` { | } ~  € ‚ ƒ „ … † ‡ ˆ ‰ Š ‹ Œ  Ž   ‘ ’ “ ” • – — ˜ ™ š › œ  ž Ÿ   ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ­ ® ¯ ° ± ´ µ ¶ · ¸ º » ¼ ½ ¾ ¿ Æ Ð × Ø ø ÷ Þ ß ñ ð æ


update produto
SET nome = (REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(nome,char(33), ''),char(34), ''),char(35), ''),char(36), ''),char(37), ''),char(38), 'E'),char(39), ''),char(40), ''),char(41), ''),char(42), ''),char(43), ''),char(44), ''),char(45), ''),char(46), ''),char(47), ''),char(58), ''),char(59), ''),char(60), ''),char(61), ''),char(62), ''),char(63), ''),char(64), 'A'),char(94), ''),char(95), ''),char(93), ''),char(92), ''),char(91), ''),char(96), ''),char(123), ''),char(124), ''),char(125), ''),char(126), ''),char(127), ''),char(128), 'E'),char(130), ''),char(131), 'f'),char(132), ''),char(133), ''),char(134), ''),char(135), ''),char(136), ''),char(137), ''),char(138), 'S'),char(139), ''),char(140), ''),char(142), 'Z'),char(145), ''),char(146), ''),char(147), ''),char(148), ''),char(149), ''),char(150), ''),char(151), ''),char(152), ''),char(153), ''),char(154), 's'),char(155), ''),char(156), ''),char(158), 'z'),char(159), 'Y'),char(160), ''),char(161), 'i'),char(162), 'c'),char(163), 'E'),char(164), ''),char(165), ''),char(166), ''),char(168), ''),char(169), ''),char(170), 'a'),char(171), ''),char(172), ''),char(173), ''),char(174), 'R'),char(175), ''),char(176), ''),char(177), ''),char(180), ''),char(181), 'u'),char(182), ''),char(183), ''),char(184), ''),char(186), 'o'),char(187), ''),char(188), ''),char(189), ''),char(190), ''),char(191), ''),char(198), 'E'),char(208), 'D'),char(215), 'x'),char(216), 'O'),char(248), 'o'),char(247), ''),char(222), 'b'),char(223), 'B'),char(241), 'n'),char(240), 'd'),char(230), 'e'))
WHERE   (PATINDEX('%[!#$%&()*+,-./:;<=>?{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¿ÆÐ×ØÞß÷ø]%', Nome) > 0);
Base comando: UPDATE tabela set coluna = (REPLACE(coluna, 'caracter incorreto','caracter novo'))

Para saber qual caracter é respectivo ao numero, consulte a Tabela ASCII disponivel abaixo e busque diretamente no sql com o comando a seguir, colocando a numeração entre parênteses: SELECT CHAR( )

Captura_de_tela_20210426_095004.png

33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
m n o p q r s t u v w x y z { | } ~   ƒ ˆ Š Œ  Ž  
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
˜ š œ  ž Ÿ   ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ­ ® ¯ ° ± ² ³ ´ µ · ¸
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ü Ý Þ
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ
Oliveiracriado em 26 abr 2021 alterado em 20 jun 2024

Base conhecimento Outros Banco De Dados

1623 | 101