1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
| /*==============================================================*/
/* Nom de SGBD : Sybase SQL Anywhere 11 */
/* Date de création : 23/08/2011 15:47:30 */
/*==============================================================*/
if exists(select 1 from sys.sysforeignkey where role='FK_EMPLOYE_APPARTIEN_CAPABILI') then
alter table EMPLOYE
delete foreign key FK_EMPLOYE_APPARTIEN_CAPABILI
end if;
if exists(select 1 from sys.sysforeignkey where role='FK_POINTAGE_EFFECTUE_EMPLOYE') then
alter table POINTAGE
delete foreign key FK_POINTAGE_EFFECTUE_EMPLOYE
end if;
if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='CAPABILITY_PK'
and t.table_name='CAPABILITY'
) then
drop index "CAPABILITY".CAPABILITY_PK
end if;
if exists(
select 1 from sys.systable
where table_name='CAPABILITY'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table "CAPABILITY"
end if;
if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='APPARTIENT_FK'
and t.table_name='EMPLOYE'
) then
drop index EMPLOYE.APPARTIENT_FK
end if;
if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='EMPLOYE_PK'
and t.table_name='EMPLOYE'
) then
drop index EMPLOYE.EMPLOYE_PK
end if;
if exists(
select 1 from sys.systable
where table_name='EMPLOYE'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table EMPLOYE
end if;
if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='EFFECTUE_FK'
and t.table_name='POINTAGE'
) then
drop index POINTAGE.EFFECTUE_FK
end if;
if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='POINTAGE_PK'
and t.table_name='POINTAGE'
) then
drop index POINTAGE.POINTAGE_PK
end if;
if exists(
select 1 from sys.systable
where table_name='POINTAGE'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table POINTAGE
end if;
/*==============================================================*/
/* Table : "CAPABILITY" */
/*==============================================================*/
create table "CAPABILITY"
(
ID_CAP integer not null,
NOM_CAP long varchar null,
MANAGER long varchar null,
constraint PK_CAPABILITY primary key (ID_CAP)
);
/*==============================================================*/
/* Index : CAPABILITY_PK */
/*==============================================================*/
create unique index CAPABILITY_PK on "CAPABILITY" (
ID_CAP ASC
);
/*==============================================================*/
/* Table : EMPLOYE */
/*==============================================================*/
create table EMPLOYE
(
ID_EMP integer not null,
ID_CAP integer not null,
NOM long varchar null,
PRENOM long varchar null,
TYPE_TRAVAIL long varchar null,
constraint PK_EMPLOYE primary key (ID_EMP)
);
/*==============================================================*/
/* Index : EMPLOYE_PK */
/*==============================================================*/
create unique index EMPLOYE_PK on EMPLOYE (
ID_EMP ASC
);
/*==============================================================*/
/* Index : APPARTIENT_FK */
/*==============================================================*/
create index APPARTIENT_FK on EMPLOYE (
ID_CAP ASC
);
/*==============================================================*/
/* Table : POINTAGE */
/*==============================================================*/
create table POINTAGE
(
ID_P integer not null,
ID_EMP integer not null,
TYPE smallint null,
"DATE" date null,
HEURE time null,
constraint PK_POINTAGE primary key (ID_P)
);
/*==============================================================*/
/* Index : POINTAGE_PK */
/*==============================================================*/
create unique index POINTAGE_PK on POINTAGE (
ID_P ASC
);
/*==============================================================*/
/* Index : EFFECTUE_FK */
/*==============================================================*/
create index EFFECTUE_FK on POINTAGE (
ID_EMP ASC
);
alter table EMPLOYE
add constraint FK_EMPLOYE_APPARTIEN_CAPABILI foreign key (ID_CAP)
references "CAPABILITY" (ID_CAP)
on update restrict
on delete cascade;
alter table POINTAGE
add constraint FK_POINTAGE_EFFECTUE_EMPLOYE foreign key (ID_EMP)
references EMPLOYE (ID_EMP)
on update restrict
on delete cascade;
et voilà l'erreur que j'ai:Erreur
[B]Requête SQL:
/*==============================================================*//* Nom de SGBD : Sybase SQL Anywhere 11 *//* Date de création : 23/08/2011 15:47:30 *//*==============================================================*/ IF EXISTS (
SELECT 1
FROM sys.sysforeignkey
WHERE role = 'FK_EMPLOYE_APPARTIEN_CAPABILI'
)
THEN
ALTER TABLE EMPLOYE DELETE FOREIGN KEY FK_EMPLOYE_APPARTIEN_CAPABILI END IF ; |
Partager