-1
INSERT INTO ry_useraccount
(
  'Id', 
  'UserId', 
  'FreeAmount', 
  'PayFrozenAmount', 
  'WithdrawFrozenAmount', 
  'CurrentAsset', 
  'CreateTime', 
  'UpdateTime'
) VALUES
(
  '1', 
  '52501', 
  '600', 
  '0', 
  '0', 
  '0', 
  NOW(), 
  NOW()
);

If just look at the sql,it is correct,but when I run it,the navicat said

“[SQL]INSERT INTO ry_useraccount('Id', 'UserId', 'FreeAmount', 'PayFrozenAmount', 'WithdrawFrozenAmount', 'CurrentAsset', 'CreateTime', 'UpdateTime') VALUES('1', '52501', '600', '0', '0', '0', NOW(), NOW()); [Err] 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', 'UserId', 'FreeAmount', 'PayFrozenAmount', 'WithdrawFrozenAmount', 'Curren' at line 1”

. I cannot find the reason.I guess that maybe some white space cause the result,but after I delete all the white spaces,it still didn't work.

Ullas
  • 11,450
  • 4
  • 33
  • 50
Farb
  • 468
  • 6
  • 11

1 Answers1

1

The single quote are for literal string not for column name (you can use backticks if you need column name with space or with reserved words )

INSERT INTO ry_useraccount(Id, UserId, FreeAmount, PayFrozenAmount, WithdrawFrozenAmount, CurrentAsset, CreateTime, UpdateTime) 
VALUES(1, 52501, 600, 0, 0, 0, NOW(), NOW());
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107