Registriert seit: 4. Nov 2005
Ort: Basel
442 Beiträge
Delphi XE2 Enterprise
|
DB erstellung / Master - Detail 2x Problem
2. Feb 2006, 17:36
Datenbank: Firebird • Version: 1.5 • Zugriff über: Zeos
Hallo zusammen
bin wirklich seit längerer Zeit am expeimentieren unter Verwendung von IBExpert und
IBConsole ( Interbase ).
Habe hier ein Script welches 3 Tabellen erstellen soll mit einigen Domains und Generatoren.
Das Prolem ist dass es z.B. mit IBConsole geht und mit IBExpert dann z.T wieder nicht.
Interessant ( nicht wirklich ) finde ich es auch wenn ich eine DB mit IBExpert anschaue ( SQL )
dann das Script kopiere und Versuche die leiche DB zu erstellen das das dann nicht geht.
Mit IBConsole geht es aber dann wieder. Bin echt am
Könntet Ihr Bitte mein SQL Script anschauen?
Die Tabellen ALTERSHEIM > ALTERSHEIM_K
> ALTERSHEIM_V > ALTERSHEIM_VD
ALTERSHEIM_S ohne Verknüpfungen
( Bin mir auch am überlegen ob es womöglich sinnvoller ist wenn die ganze "Struktur" nicht
auf der Datenbank liegt sonder von Delphi "Erzeugt" wird. Will heissen:
ALTERSHEIM > ALTERSHEIM_K bei dem löchen von ALTERSHEIM alle Datensätze von ALTERSHEIM_K
vom Delphi löschen lassen )
Bin Dankbar für Eure Ratschläge
Manfred
PS: als ID verwend ich GUID deshalb habe ich die Domain auf "ID" AS CHAR(32) CHARACTER SET ISO8859_1 NOT NULL; gesetzt.
SQL-Code:
/******************************************************************************/
/**** Generated by IBExpert 01.02.2006 17:16:07 ****/
/******************************************************************************/
SET SQL DIALECT 3;
SET NAMES UNICODE_FSS;
/******************************************************************************/
/**** DOMAINS START ****/
/******************************************************************************/
CREATE DOMAIN " ID" AS CHAR(32) CHARACTER SET ISO8859_1 NOT NULL;
CREATE DOMAIN " PLZ" AS VARCHAR(10) CHARACTER SET UNICODE_FSS;
CREATE DOMAIN " STATUS" AS VARCHAR(10) CHARACTER SET UNICODE_FSS;
CREATE DOMAIN " T10" AS VARCHAR(10) CHARACTER SET UNICODE_FSS;
CREATE DOMAIN " T20" AS VARCHAR(20) CHARACTER SET UNICODE_FSS;
CREATE DOMAIN " T30" AS VARCHAR(30) CHARACTER SET UNICODE_FSS;
CREATE DOMAIN " T50" AS VARCHAR(50) CHARACTER SET UNICODE_FSS;
CREATE DOMAIN " T70" AS VARCHAR(50) CHARACTER SET UNICODE_FSS;
CREATE DOMAIN " T130" AS VARCHAR(130) CHARACTER SET UNICODE_FSS;
CREATE DOMAIN " T255" AS VARCHAR(255) CHARACTER SET UNICODE_FSS;
CREATE DOMAIN " DATUM" AS DATE;
CREATE DOMAIN " TIME_S" AS TIMESTAMP;
CREATE DOMAIN " I_O" AS DECIMAL(9, 0);
CREATE DOMAIN " TEXT" AS BLOB SUB_TYPE TEXT SEGMENT SIZE 80 CHARACTER SET ISO8859_1;
/******************************************************************************/
/**** DOMAINS END ****/
/******************************************************************************/
/******************************************************************************/
/**** GENERATOREN START ****/
/******************************************************************************/
CREATE GENERATOR " GEN_ALTERSHEIM";
CREATE GENERATOR " GEN_ALTERSHEIM_K";
CREATE GENERATOR " GEN_ALTERSHEIM_STAT";
CREATE GENERATOR " GEN_ALTERSHEIM_V";
CREATE GENERATOR " GEN_ALTERSHEIM_VD";
/******************************************************************************/
/**** GENERATOREN END ****/
/******************************************************************************/
/
/******************************************************************************/
/******************************************************************************/
/******************************************************************************/
/******************************************************************************/
/******************************************************************************/
/**** ALTERSHEIM Start ****/
/******************************************************************************/
CREATE TABLE ALTERSHEIM
(
" ID" " ID",
" G_NR" " T30",
" U_NR" " T30",
" NAME" " T130",
" STR" " T130",
" PLZ" " PLZ",
" ORT" " T50",
" TEL" " T20",
" FAX" " T20",
" EMAIL" " T50",
" HOMEPAGE" " T130",
" ANZ_PL" " T10",
" ARBEITER" INTEGER,
" MT" SMALLINT,
" AKZEPTANZ" INTEGER,
" STATUS" INTEGER,
" MEMO" " TEXT",
" NK" INTEGER,
" KF" INTEGER,
" L_UPDATE" " TIME_S",
" STAT_UPDATE" INTEGER,
" STAT_DEL" INTEGER
);
/******************************************************************************/
/**** Primary Keys ****/
/******************************************************************************/
ALTER TABLE ALTERSHEIM ADD PRIMARY KEY (ID);
/******************************************************************************/
/**** ALTERSHEIM END ****/
/******************************************************************************/
/******************************************************************************/
/**** ALTERSHEIM KONTAKTE START ****/
/******************************************************************************/
CREATE TABLE ALTERSHEIM_K
(
" ID" " ID",
" G_NR" " T30",
" U_NR" " T30",
" ID_SPARTE" " ID",
" K_ANREDE" " T20",
" K_NAME" " T50",
" K_VORNAME" " T50",
" K_POSITION" " T50",
" K_TEL_1" " T20",
" K_TEL_2" " T20",
" K_EMAIL" " T50",
" K_MEMO" " TEXT",
" L_UPDATE" " TIME_S",
" STAT_UPDATE" INTEGER,
" STAT_DEL" INTEGER
);
/******************************************************************************/
/**** Primary Keys & REFERENCES ****/
/******************************************************************************/
ALTER TABLE ALTERSHEIM_K ADD PRIMARY KEY (ID);
ALTER TABLE ALTERSHEIM_K ADD FOREIGN KEY (" ID_SPARTE") REFERENCES ALTERSHEIM (" ID") ON DELETE CASCADE;
/******************************************************************************/
/**** ALTERSHEIM KONTAKTE END ****/
/******************************************************************************/
/******************************************************************************/
/**** ALTERSHEIM VERTEILUNG START ****/
/******************************************************************************/
CREATE TABLE ALTERSHEIM_V
(
" ID" " ID",
" G_NR" " T30",
" U_NR" " T30",
" ID_SPARTE" " ID",
" DATUM" " T20",
" K_PERSON" " T50",
" K_DURCH" " T130",
" MEMO" " TEXT",
" L_UPDATE" " TIME_S",
" STAT_UPDATE" INTEGER,
" STAT_DEL" INTEGER
);
/******************************************************************************/
/**** Primary Keys & REFERENCES ****/
/******************************************************************************/
ALTER TABLE ALTERSHEIM_V ADD PRIMARY KEY (ID);
/**ALTER TABLE ALTERSHEIM_V ADD FOREIGN KEY ("ID_SPARTE") REFERENCES ALTERSHEIM ("ID") ON DELETE CASCADE;
/******************************************************************************/
/**** ALTERSHEIM VERTEILUNG END ****/
/******************************************************************************/
/******************************************************************************/
/**** ALTERSHEIM VERTEILUNG DETAIL START ****/
/******************************************************************************/
CREATE TABLE ALTERSHEIM_VD
(
" ID" " ID",
" G_NR" " T30",
" U_NR" " T30",
" ID_V" " ID",
" BIBEL_TYP" " T130",
" MENGE" INTEGER,
" L_UPDATE" " TIME_S",
" STAT_UPDATE" INTEGER,
" STAT_DEL" INTEGER
);
/******************************************************************************/
/**** Primary Keys & REFERENCES ****/
/******************************************************************************/
ALTER TABLE ALTERSHEIM_VD ADD PRIMARY KEY (ID);
ALTER TABLE ALTERSHEIM_VD ADD FOREIGN KEY (" ID_V") REFERENCES ALTERSHEIM_V (" ID") ON DELETE CASCADE;
/******************************************************************************/
/**** ALTERSHEIM VERTEILUNG DETAIL END ****/
/******************************************************************************/
/******************************************************************************/
/**** ALTERSHEIM STATISTIK START ****/
/******************************************************************************/
CREATE TABLE ALTERSHEIM_S
(
" ID" " ID",
" G_NR" " T30",
" U_NR" " T30",
" GJ" INTEGER,
" Q" INTEGER,
" JZ" INTEGER,
" QZ" INTEGER,
" L_UPDATE" " TIME_S",
" STAT_UPDATE" INTEGER,
" STAT_DEL" INTEGER
);
/******************************************************************************/
/**** Primary Keys & REFERENCES ****/
/******************************************************************************/
ALTER TABLE ALTERSHEIM_S ADD PRIMARY KEY (ID);
/******************************************************************************/
/**** ALTERSHEIM STATISTIK END ****/
/******************************************************************************/
|