Search code examples
firebirdfirebird2.1sql

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?


Solution

  • 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