问题
I am writing a query in Microsoft Access. and I am getting a syntax error in "field description". Here is the code:
CREATE TABLE CONS
(
Com_Type text,
Cons_2008 double(10,2),
Cons_2009 double(10,2),
Cons_2010 double(10,2)
);
Thanks!
回答1:
CREATE TABLE CONS
(
Com_Type TEXT(150),
Cons_2008 DOUBLE,
Cons_2009 DOUBLE,
Cons_2010 DOUBLE
);
回答2:
Specify the length of the text field, unless you want a field of length 255 when called through an Access query or a Memo
field when called through an ADO connection.
Com_Type Text(50),
The Double
type has no size and scale specifications. Either drop them or use the Decimal
type.
Cons_2008 Double
Or
Cons_2008 Decimal(10, 2)
Note: See this SO answer for a limitation related to the decimal type.
When using the Double
type, you can still specify a format in the TextBoxes
linked to this table column. That way you can force the display of 2 decimals.
来源:https://stackoverflow.com/questions/21650135/writing-query-in-microsoft-access-error-in-field-description