Seth Spearman
Seth Spearman

Reputation: 6780

Can you define a NULL on a column definition in the Create Table statement in a Firebird DB?

I am using SQL Manager Lite to try to run a DDL Create Table script. I am new to Firebird and I don't know why it isn't working. The following script...

create table Contacts (
    ID                      integer            not null,
    FirstName               varchar(64)        not null,
    LastName                varchar(64)        not null,
    MiddleInitial           varchar(1)             null
);

Is causing a parsing error (UNIDENTIFIED TOKEN) on the null constraint for the MiddleInitial column.

Here is the exact error returned by Sql Lite...

Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 5, column 52.
Null.

Is the NULL constraint not allowed in Create Table DDL for firebird?

Upvotes: 0

Views: 406

Answers (2)

Hugues Van Landeghem
Hugues Van Landeghem

Reputation: 6808

Null is not allowed but by default it's null

You can take a look at this grammar

Upvotes: 0

Eduardo Rascon
Eduardo Rascon

Reputation: 703

I'm not sure if it works, as I can't test it right now, but try removing null from the statement:

CREATE TABLE Contacts(
    Id integer not null,
    First_Name varchar(64) not null,
    Last_Name varchar(64) not null,
    Middle_Initial varchar(1)
);

See this link: CREATE DATABASE

Upvotes: 2

Related Questions