我觉得proble是在查询CONCAT(INSERT ....)字符例如“或”我总是得到错误:不正确的INSERT现在()
0 16:35:45 call InsertUser(990099,2,1,"Title1","Gosc","aaa","192.168.1.1",21426,23453245,1) Error Code: 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 '16:35:44, 1, 1)' at line 2
到程序:
DELIMITER $$
DROP PROCEDURE IF EXISTS InsertUser $$
CREATE PROCEDURE `InsertUser`
(UserId int, ServiceId int(11), CommentsId int(11),
Title varchar(255), Nick varchar(20), content text,
Ip varchar(15), TableCrc int(5),Crc32 int(11) unsigned,
ArticleId int(11))
BEGIN
DECLARE tableName VARCHAR(65535);
set tableName = CONCAT('User',userId);
CALL CreateUsersTable(tableName);
set @a = CONCAT("INSERT INTO `", tableName ,"` (`ServiceId`,
`CommentsId`, `Title`, `Content`,`Ip`,
`TableCrc`, `Crc32`, `ArticleId`,`Date`,
`ViewStatus`, `CommentStatus`)
VALUES (",ServiceId,", ",CommentsId,", '",Title,"',
'",Content,"', '",Ip,"', ",TableCrc,",
",Crc32,", ",ArticleId,",
",now(),", 1, 1);");
PREPARE stmi FROM @a;
EXECUTE stmi;
DEALLOCATE PREPARE stmi;
END$$
你试图把周围的现在报价()语句? ''“,now(),”',1,1);“);' – Steve 2012-08-14 14:46:59
是的,我是真的,但它不起作用 – Przemek 2012-08-14 15:07:46
它现在确定问题是与参数在输入 – Przemek 2012-08-14 15:15:49