Subject | RE: [firebird-support] Dynamic SQL Error SQL error code = -104. Unexpected end of command - line 7, column 47 |
---|---|
Author | Svein Erling Tysvær |
Post date | 2014-06-10T10:18:59Z |
>Everything seems to be properly formed - can anyone cast some light on what I am missing here?Sure, the problem is not in create table, but in the trigger - you need SET TERM since you cannot use ; inside the trigger if it is also the terminator:
CREATE TABLE "Administrators" (
"_Id" INTEGER NOT NULL,
"_MyDetailId" INTEGER DEFAULT 0,
"_Name" VARCHAR(50),
"_Designation" VARCHAR(50),
"_Address" BLOB SUB_TYPE TEXT SEGMENT SIZE 255 CHARACTER SET ASCII,
"_Emails" BLOB SUB_TYPE TEXT SEGMENT SIZE 255 CHARACTER SET ASCII,
"_TelephoneNumbers" BLOB SUB_TYPE TEXT SEGMENT SIZE 255 CHARACTER SET ASCII,
"_Reference" VARCHAR(50)
);
ALTER TABLE "Administrators" ADD CONSTRAINT "PrimaryKey" PRIMARY KEY ("_Id");
CREATE INDEX "_Id" ON "Administrators"("_Id");
CREATE INDEX "_MyDetailId" ON "Administrators"("_MyDetailId");
CREATE GENERATOR "GEN_Administrators__Id";
SET TERM ^^ ;
CREATE TRIGGER "TR_AI_Administrators__Id" FOR "Administrators"
ACTIVE BEFORE INSERT
POSITION 0
AS
BEGIN
IF (NEW."_Id" IS NULL) THEN
NEW."_Id" = GEN_ID("GEN_Administrators__Id", 1);
END ^^
SET TERM ; ^^
HTH,
Set