就我的知识而言,我的查询似乎没问题:
CREATE TABLE PORTAL_NOTES (
id numeric NOT NULL,
school_id numeric,
syear numeric(4,0),
title character varying(255),
content character varying(5000),
sort_order numeric,
published_user numeric,
published_date timestamp(0),
start_date date,
end_date date,
published_profiles character varying(255)
);
但是我收到了这个错误:
#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 '(1) , start_date date, end_date date, published_profiles characte' at line 9
有人可以帮我调试这个问题吗?
答案 0 :(得分:0)
试试这个:
CREATE TABLE PORTAL_NOTES (
id numeric NOT NULL,
school_id numeric,
syear numeric(4,0),
title character varying(255),
content character varying(5000),
sort_order numeric,
published_user numeric,
published_date timestamp,
start_date date,
end_date date,
published_profiles character varying(255)
);
问题是因为你在timestamp(0)
设置了长度,这不需要长度。
答案 1 :(得分:0)
CREATE TABLE PORTAL_NOTES (
id numeric NOT NULL,
school_id numeric,
syear numeric(4,0),
title character varying(255),
content character varying(5000),
sort_order numeric,
published_user numeric,
published_date timestamp,
start_date date,
end_date date,
published_profiles character varying(255)
);
使用上面的代码.. 我认为你的mysql版本较低,所以它不支持长度.. 更新mysql版本或您可以使用上述查询。