Reputation: 400
I have the following query, which fails at the dash:
'create table 4$0_Anzahl_der_Anforderungen_des_V-NEF_2019 (Monat INTEGER, Eigenschaft_1 FLOAT, constraint pk_1 primary key(Monat));' }
With the following error:
{ Error: ER_PARSE_ERROR: 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 '"4$0_Anzahl_der_Anforderungen_des_V-NEF"_2019 (Monat INTEGER, Eigenschaft_1 FLOA' at line 1
I already tried replacing the -
with \-
, but that didn't help. How do I replace it correctly?
Upvotes: 2
Views: 2376
Reputation: 133360
In mysql For create valid object name including spaces, reserved word or special char as dash, minus or plus You need backtics
create table `4$0_Anzahl_der_Anforderungen_des_V-NEF_2019`
Upvotes: 3