2
Dear, I have a table where I do some Inserts with data containing special char. Currently I use Toad for Mysql, and when I do the insertion by this editor, everything happens correctly, the special chars go up normally, but if I use the source @script.sql of mysql command line to move the same data up, these do not go up the special chars, and yes, another char. I’d like to know how to climb up the prompt the same way I climb up the Toad.
Table:
DROP TABLE
IF EXISTS DOBER.FINANCEIRO_TRANSPORTADORA;
CREATE TABLE DOBER.FINANCEIRO_TRANSPORTADORA (
TRANSPK INT (3) NOT NULL AUTO_INCREMENT
,CODIGO INT (3) NOT NULL
,NATUREZA VARCHAR(16)
,NOME VARCHAR(50) NOT NULL
,DATA_MODIF DATETIME
,USUARIO VARCHAR(10)
,PRIMARY KEY (TRANSPK)
) DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci;
INSERT:
INSERT INTO DOBER.FINANCEIRO_TRANSPORTADORA(
CODIGO,
NATUREZA,
NOME,
DATA_MODIF,
USUARIO) VALUES
(1,'Pessoa Jurídica','TRANSPORTADORA1',NOW(),'Usuario1'),
(2,'Pessoa Jurídica','TRANSPORTADORA2',NOW(),'Usuario2')
Resultado com o Toad:
1 | Pessoa Jurídica | TRANSPORTADORA1 | 30/10/2014 13:46:51 | Usuario1
2 | Pessoa Jurídica | TRANSPORTADORA2 | 30/10/2014 13:46:51 | Usuario2
Resultado com MySqlCommand:
1 | Pessoa Jurídica | TRANSPORTADORA1 | 30/10/2014 13:46:51 | Usuario1
2 | Pessoa Jurídica | TRANSPORTADORA2 | 30/10/2014 13:46:51 | Usuario2
Use the Notepad++ and the file is with UTF-8 encoding
– Thiago
The default Mysql encoding may be interfering (if not UTF-8). Experiment pass parameter
--default-character-set=utf8
. http://dev.mysql.com/doc/refman/5.0/en/mysql-command-options.html#option_mysql_default-Character-set– Caffé
Try trading single quotes for double quotes.
– Raphael Ramos
Caffé, this last comment was the solution, I inserted the --default-Character-set=utf8 at the time of connection and everything was inserted correctly.
– Thiago
Cool. I was updating my answer. Anyway if the file is not in UTF-8 you will also have problem.
– Caffé