내 첫 번째 게시물 그래서 나와 함께 곰.SQL에서 SET를 사용하여 INSERT INTO
백업에서 DB 테이블을 복원해야합니다. SQL을 정리하여 DROP TABLE, CREATE TABLE 및 INSERT INTO 명령 만 가지고 있습니다. 내 서버의 MYSQl에서 쿼리를 실행하면 쿼리가 실패합니다.
오류 메시지가 ....
MySQL은 말했다 : 문서의 표
#1064 - 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 'id='2',
unitid='1',
optionname='Baby Chair',
customtype='0',
customfeild' at line 3
쿼리는 .....
DROP TABLE IF EXISTS `jos_resman_options`;
CREATE TABLE `jos_resman_options`
(
`id` int(4) NOT NULL AUTO_INCREMENT,
`unitid` int(9) NOT NULL DEFAULT '0',
`optionname` varchar(255) NOT NULL DEFAULT '',
`customtype` tinyint(1) NOT NULL DEFAULT '0',
`customfeild` varchar(150) NOT NULL DEFAULT '',
`moreinformation` varchar(255) NOT NULL DEFAULT '',
`totaloptions` tinyint(1) NOT NULL DEFAULT '0',
`price` decimal(10,2) NOT NULL DEFAULT '0.00',
`minvalue` int(2) NOT NULL DEFAULT '0',
`maxvalue` int(2) NOT NULL DEFAULT '0',
`formobject` int(1) NOT NULL DEFAULT '0',
`enabled` tinyint(1) NOT NULL DEFAULT '0',
`priceoption` int(1) NOT NULL DEFAULT '0',
`taxfree` tinyint(1) NOT NULL DEFAULT '0',
`compulsory` tinyint(1) NOT NULL DEFAULT '0',
`istax` tinyint(1) NOT NULL DEFAULT '0',
`isinsure` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=75;
INSERT INTO `jos_resman_options`
VALUES
id='2',
unitid='1',
optionname='Baby Chair',
customtype='0',
customfeild='',
moreinformation='Baby Chair',
totaloptions='0',
price='0.00',
minvalue='1',
maxvalue='2',
formobject='1',
enabled='1',
priceoption='2',
taxfree='1',
compulsory='0',
istax='0',
isinsure='0';
CREATE TABLE 부분이 실행될 때 그 자체가 re는 오류 메시지가 아닙니다. 쿼리의 INSERT INTO 부분이 실행될 때만 오류 메시지가 표시됩니다. INSERT INTO 데이터는 데이터베이스의 백업에서 직접 가져온 데이터이므로 데이터를 확인해야합니다 ?? 모든 입력
에 대한
많은 덕분에 그들 모두는 오류 메시지와 함께 실패, 괄호에 넣어 필드를 기본값으로 자동 증가를 변경 제안 사항을 모두 노력했다. 최신 오류 메시지는 다음과 같습니다. 다시 한 번 감사드립니다.! ID 렸기 때문에 ID 필드를 삭제
Error
SQL query:
INSERT INTO `jos_resman_options`
SET unitid = '1',
optionname = 'Baby Chair',
customtype = '0',
customfeild = '',
moreinformation = 'Baby Chair',
totaloptions = '0',
price = '0.00',
minvalue = '1',
maxvalue = '2',
formobject = '1',
enabled = '1',
priceoption = '2',
taxfree = '1',
compulsory = '0',
istax = '0',
isinsure = '0'
MySQL said: Documentation
#1064 - 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 'maxvalue='2',
formobject='1',
enabled='1',
priceoption='2',
taxfree='1',' at line 12
괄호가 필요합니다. INSERT INTO ' 식 ( 값 jos_resman_options' '2', unitid = '1' 이 Optionname = '유아 자' customtype = '0', customfeild = '' moreinformation = '유아 의자' totalvalions = '0', price = '0.00', minvalue = '1', maxvalue = '2', formobject = '1', enabled = '1', priceoption = '2', taxfree = '1', 강제 = '0', istax = '0', isinsure = '0'); – haunted85
값 섹션 주위에 괄호를 추가하십시오. VALUES ( id = '2', .....) – WillardSolutions
또한 자동 증가 ID가있는 경우 수동으로 추가해야하는 이유는 id 값을 삽입하지 않는 것입니다. –