Home » Forums » DBManager General
 
Erro executando querys (1615 previews)
Erro executando querys Posted in 19th, 05/2006 12:02 by ricardoesteves
Estou tendoo seguinte erro ao executar uma query e não sei o que esta errado:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ENGINE=InnoDB;
INSERT INTO `aa_enquete` (IDEnq, Pergunta, Status) VALUES (1, '' at line 6

CREATE TABLE `aaa` (
`ID` INT(3) unsigned NOT NULL auto_increment,
`CP1` text NOT NULL,
`CP2` SET('0','1') NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`),
) ENGINE=InnoDB;

INSERT INTO `aaa` (ID, CP1, CP2) VALUES (1, '111', '0');
INSERT INTO `aaa` (ID, CP1, CP2) VALUES (2, '222', '1');
Ricardo /
Re: Erro executando querys Posted in 19th, 05/2006 01:47 by support
Olá Ricardo,

Retire a vírgula após PRIMARY KEY (`ID`)


Support / DBTools Software
Re: Erro executando querys Posted in 19th, 05/2006 01:58 by ricardoesteves
Opa, tava errado mesmo.
Simplifiquei para:
CREATE TABLE `aaa` (
`ID` INT(3) unsigned NOT NULL auto_increment,
`CP` text NOT NULL,
PRIMARY KEY (`ID`)
) TYPE=InnoDB;

INSERT INTO `aaa` (ID, CP,) VALUES ('1', '2');

O erro:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';
INSERT INTO `aaa` (ID, CP,) VALUES ('1', '2')' at line 5
Ricardo /
Re: Erro executando querys Posted in 19th, 05/2006 02:33 by support
Ricardo,

Agora é fácil. É só habilitar o parser para multiplas comandos.
Na primeira linha do editor acrescente o comando

-- USEGO

Após cada statement utilize o comando

GO

Veja que estes comandos devem ser digitados em uma linha em branco. Opcionalmente você pode ativar estes parâmetros no Preferênces do DBManager. Entretanto se for criar Procedures/Functions é bastante recomendado utilizar da forma manual acima.

Atenciosamente,

Support / DBTools Software
Re: Erro executando querys Posted in 19th, 05/2006 02:48 by ricardoesteves
Vc poderia escrever um exemplo, testei e não funcionou ..
Ricardo /
Re: Erro executando querys Posted in 22th, 05/2006 09:51 by support
Olá,

Segue abaixo exemplo completo:

-- USEGO
CREATE TABLE `aaa` (
`ID` INT(3) unsigned NOT NULL auto_increment,
`CP1` text NOT NULL,
`CP2` SET('0','1') NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB;
GO
INSERT INTO `aaa` (ID, CP1, CP2) VALUES (1, '111', '0');
GO
INSERT INTO `aaa` (ID, CP1, CP2) VALUES (2, '222', '1');
GO

See that when using the command GO there is no need to use the semicolon.


Support / DBTools Software
Erro executando querys (1615 previews)
Legends

Topic has Replies
Topic With no Replies
 
Home » Forums » DBManager General