Why is there an err parsing this DDL, and why can&

2019-08-30 18:09发布

问题:

With this DDL ("BLA" is a tablename in the form "CCR130329093342")

ALTER TABLE BLA ADD salvation float NOT NULL WITH DEFAULT

...I'm getting, "There was an error parsing the query. [Token line number, Token line offset,, Token in error,,]"

Okay, then, which line number? offset? It knows/thinks there's a problem, but can't or won't say what or where.

Is there anything obviously wrong with this DDL? Should it be this instead:

ALTER TABLE BLA ADD salvation float NOT NULL WITH DEFAULT 0.0

?

UPDATE

If I revert the DDL back to the original simple type (without adding "NOT NULL", simply "alter bla add blah nvarchar(12)" I don't get the "query could not be parsed" msg except in the one that declares a float (shown above)...does SQL-Server-CE hate on floats, or...???

回答1:

default needs a value:

alter table bla add salvation float not null with default(0.0)