我正在將xls/csv文件解析到數據庫中。對於每個文件,我都有一個表,其中的列由文件列名稱的哈希命名。帶有哈希列名的CREATE TABLE語句中的MySQL語法錯誤
對於列
- Nazwisko
- IMIE
- Adres1
- Adres2
- 斯托
- 電話
- KOD
- 電子郵件
- Województwo
我已經SQL:
CREATE TABLE premium_import_temp_worksheet_9 (
id INTEGER NOT NULL AUTO_INCREMENT,
f37c4446e4a882972cd3a80053dd795f VARCHAR(255),
d5bfdd6746ff1a364399acb6e6526b7a VARCHAR(255),
f7e2db7542ea17f0fcc1a46ee21f860b VARCHAR(255),
7161b0ab070daf8e20a2b62f2ef13b81 VARCHAR(255),
4f4e297d754b67e7a104f58b2bcdb850 VARCHAR(255),
0975cf6baccb3862c31522c2b5b8fabc VARCHAR(255),
d1c0419824dea874935502cf6d7c946f VARCHAR(255),
ce8ae9da5b7cd6c3df2929543a9af92d VARCHAR(255),
d7f1213d49993b7ce9ce02463ea1eeda VARCHAR(255),
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
,一切都沒有任何錯誤執行,但:
- 公司名稱
- 電話
- sffd
- sdf
- sdfff
我:
CREATE TABLE premium_import_temp_worksheet_8 (
id INTEGER NOT NULL AUTO_INCREMENT,
e7b47c58815acf1d3afa59a84b5db7fb VARCHAR(255),
bcc254b55c4a1babdf1dcb82c207506b VARCHAR(255),
6e87a4f6ea8244d7e04cb52e495d6693 VARCHAR(255),
d9729feb74992cc3482b350163a1a010 VARCHAR(255),
c90e651df62a9057d9bc8f48b42da7d0 VARCHAR(255),
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci
和錯誤:
mysqlt error: [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 '6e87a4f6ea8244d7e04cb52e495d6693 VARCHAR(255), d9729feb74992cc3482b350163a1a010 ' at line 5] in EXECUTE("CREATE TABLE premium_import_temp_worksheet_7 (id INTEGER NOT NULL AUTO_INCREMENT, e7b47c58815acf1d3afa59a84b5db7fb VARCHAR(255), bcc254b55c4a1babdf1dcb82c207506b VARCHAR(255), 6e87a4f6ea8244d7e04cb52e495d6693 VARCHAR(255), d9729feb74992cc3482b350163a1a010 VARCHAR(255), c90e651df62a9057d9bc8f48b42da7d0 VARCHAR(255), PRIMARY KEY (id)) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci")
我不知道什麼是這兩個語句的語法之間的差異。請幫忙。
嘗試爲每個col名稱添加反引號。# –