SOS-Générer une base de donnée

Profil bloqué -  
 Profil bloqué -
Bonjour,

je voudrais générer une base de données dans Mysql (EasyPhp) en utilisant un script (.sql)

que j'ai généré mais ça affiche toujours une erreur sachant que ma base de données est

correcte .je sais pas koi faire

voila l'erreur


Il semble qu'il y ait une erreur dans votre requête SQL. Le message ci-bas peut vous aider à en trouver la cause

MySQL a répondu:

#1064 - Erreur de syntaxe près de 'if exists(select 1 from sys.sysforeignkey where role='FK_CONTENIR_CONTENIR_INFOR' à la ligne 1



A voir également:

3 réponses

HostOfSeraphim Messages postés 6750 Date d'inscription   Statut Contributeur Dernière intervention   1 608
 
prière de me répondre!!

Oui, ben si on veut. On est pas à ta disposition. Surtout pas en 20 minutes...

Ensuite, est-ce que tu pourrais faire un copier-coller du début de ton fichier .sql ?


0
Profil bloqué
 
j'ai essayé de le copier mais en vain :s :s c trop long
0
Profil bloqué
 
if exists(select 1 from sys.sysforeignkey where role='FK_CONTENIR_CONTENIR_INFORMAT') then
alter table CONTENIR
delete foreign key FK_CONTENIR_CONTENIR_INFORMAT
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_CONTENIR_CONTENIR3_TABLE_DE') then
alter table CONTENIR
delete foreign key FK_CONTENIR_CONTENIR3_TABLE_DE
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_FAX_HERITAGE__TELECOM') then
alter table FAX
delete foreign key FK_FAX_HERITAGE__TELECOM
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_GSM_HERITAGE__TELECOM') then
alter table GSM
delete foreign key FK_GSM_HERITAGE__TELECOM
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_INCLURE_INCLURE_TELECOM') then
alter table INCLURE
delete foreign key FK_INCLURE_INCLURE_TELECOM
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_INCLURE_INCLURE2_TABLE_DE') then
alter table INCLURE
delete foreign key FK_INCLURE_INCLURE2_TABLE_DE
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_MATERIEL_HERITAGE__INFORMAT') then
alter table MATERIEL
delete foreign key FK_MATERIEL_HERITAGE__INFORMAT
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_NOUR_HERITAGE__INFORMAT') then
alter table NOUR
delete foreign key FK_NOUR_HERITAGE__INFORMAT
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_OUTLOOK_HERITAGE__INFORMAT') then
alter table OUTLOOK
delete foreign key FK_OUTLOOK_HERITAGE__INFORMAT
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_RESEAU_L_HERITAGE__TELECOM') then
alter table RESEAU_LAN
delete foreign key FK_RESEAU_L_HERITAGE__TELECOM
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_RESEAU_W_HERITAGE__TELECOM') then
alter table RESEAU_WAN
delete foreign key FK_RESEAU_W_HERITAGE__TELECOM
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_SAP_HERITAGE__INFORMAT') then
alter table SAP
delete foreign key FK_SAP_HERITAGE__INFORMAT
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_SYSTEME__HERITAGE__INFORMAT') then
alter table SYSTEME_D_EXPLOITATION
delete foreign key FK_SYSTEME__HERITAGE__INFORMAT
end if;

if exists(select 1 from sys.sysforeignkey where role='FK_TELEPHON_HERITAGE__TELECOM') then
alter table TELEPHONIE
delete foreign key FK_TELEPHON_HERITAGE__TELECOM
end if;
0
Profil bloqué
 
if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='CONTENIR_PK'
and t.table_name='CONTENIR'
) then
drop index CONTENIR.CONTENIR_PK
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.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='FAX_PK'
and t.table_name='FAX'
) then
drop index FAX.FAX_PK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='GSM_PK'
and t.table_name='GSM'
) then
drop index GSM.GSM_PK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='ASSOCIATION_2_PK'
and t.table_name='INCLURE'
) then
drop index INCLURE.ASSOCIATION_2_PK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='INFORMATIQUE_PK'
and t.table_name='INFORMATIQUE'
) then
drop index INFORMATIQUE.INFORMATIQUE_PK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='MATERIEL_PK'
and t.table_name='MATERIEL'
) then
drop index MATERIEL.MATERIEL_PK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='NOUR_PK'
and t.table_name='NOUR'
) then
drop index NOUR.NOUR_PK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='OUTLOOK_PK'
and t.table_name='OUTLOOK'
) then
drop index OUTLOOK.OUTLOOK_PK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='RESEAU_LAN_PK'
and t.table_name='RESEAU_LAN'
) then
drop index RESEAU_LAN.RESEAU_LAN_PK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='RESEAU_WAN_PK'
and t.table_name='RESEAU_WAN'
) then
drop index RESEAU_WAN.RESEAU_WAN_PK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='SAP_PK'
and t.table_name='SAP'
) then
drop index SAP.SAP_PK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='SYSTEME_D_EXPLOITATION_PK'
and t.table_name='SYSTEME_D_EXPLOITATION'
) then
drop index SYSTEME_D_EXPLOITATION.SYSTEME_D_EXPLOITATION_PK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='TELECOM_PK'
and t.table_name='TELECOM'
) then
drop index TELECOM.TELECOM_PK
end if;

if exists(
select 1 from sys.sysindex i, sys.systable t
where i.table_id=t.table_id
and i.index_name='TELEPHONIE_PK'
and t.table_name='TELEPHONIE'
) then
drop index TELEPHONIE.TELEPHONIE_PK
end if;

if exists(
select 1 from sys.systable
where table_name='CONTENIR'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table CONTENIR
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.systable
where table_name='FAX'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table FAX
end if;

if exists(
select 1 from sys.systable
where table_name='GSM'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table GSM
end if;

if exists(
select 1 from sys.systable
where table_name='INCLURE'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table INCLURE
end if;

if exists(
select 1 from sys.systable
where table_name='INFORMATIQUE'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table INFORMATIQUE
end if;

if exists(
select 1 from sys.systable
where table_name='MATERIEL'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table MATERIEL
end if;

if exists(
select 1 from sys.systable
where table_name='NOUR'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table NOUR
end if;

if exists(
select 1 from sys.systable
where table_name='OUTLOOK'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table OUTLOOK
end if;

if exists(
select 1 from sys.systable
where table_name='RESEAU_LAN'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table RESEAU_LAN
end if;

if exists(
select 1 from sys.systable
where table_name='RESEAU_WAN'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table RESEAU_WAN
end if;

if exists(
select 1 from sys.systable
where table_name='SAP'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table SAP
end if;

if exists(
select 1 from sys.systable
where table_name='SYSTEME_D_EXPLOITATION'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table SYSTEME_D_EXPLOITATION
end if;

if exists(
select 1 from sys.systable
where table_name='TABLE_DES_ENTITES'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table TABLE_DES_ENTITES
end if;

if exists(
select 1 from sys.systable
where table_name='TELECOM'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table TELECOM
end if;

if exists(
select 1 from sys.systable
where table_name='TELEPHONIE'
and table_type in ('BASE', 'GBL TEMP')
) then
drop table TELEPHONIE
end if;
0
Profil bloqué
 
/*==============================================================*/
/* Table : CONTENIR */
/*==============================================================*/
create table CONTENIR
(
NUM_INFO char(10) not null,
constraint PK_CONTENIR primary key (NUM_INFO)
);

/*==============================================================*/
/* Index : CONTENIR_PK */
/*==============================================================*/
create unique index CONTENIR_PK on CONTENIR (
NUM_INFO ASC
);

/*==============================================================*/
/* Table : EMPLOYE */
/*==============================================================*/
create table EMPLOYE
(
IDEMPLOYE char(10) not null,
MOT_DE_PASS char(10) not null,
NOM char(10) not null,
NUMTEL char(10) not null,
constraint PK_EMPLOYE primary key (IDEMPLOYE)
);

/*==============================================================*/
/* Index : EMPLOYE_PK */
/*==============================================================*/
create unique index EMPLOYE_PK on EMPLOYE (
IDEMPLOYE ASC
);

/*==============================================================*/
/* Table : FAX */
/*==============================================================*/
create table FAX
(
NUMTL char(10) not null,
WAN varchar(40) not null,
LAN varchar(60) not null,
TELEPHONIE_ varchar(50) not null,
FAX varchar(60) not null,
GSM varchar(20) not null,
DIVISION varchar(60) not null,
SERVICE varchar(60) not null,
DATE_DEBUT integer not null,
DATE_FIN integer not null,
RESOLU smallint not null,
NATURE_DE_L_INTERVENTION varchar(60) not null,
constraint PK_FAX primary key (NUMTL)
);

/*==============================================================*/
/* Index : FAX_PK */
/*==============================================================*/
create unique index FAX_PK on FAX (
NUMTL ASC
);

/*==============================================================*/
/* Table : GSM */
/*==============================================================*/
create table GSM
(
NUMTL char(10) not null,
WAN varchar(40) not null,
LAN varchar(60) not null,
TELEPHONIE_ varchar(50) not null,
FAX varchar(60) not null,
GSM varchar(20) not null,
DP varchar(60) not null,
SERVICE varchar(60) not null,
DATE_DEBUT integer not null,
DATE_FIN_ integer not null,
RESOLU smallint not null,
NATURE_DE_L_INTERVENTION varchar(60) not null,
INSTANCE_ long varchar not null,
OBSERVATION varchar(254) not null,
constraint PK_GSM primary key (NUMTL)
);

/*==============================================================*/
/* Index : GSM_PK */
/*==============================================================*/
create unique index GSM_PK on GSM (
NUMTL ASC
);

/*==============================================================*/
/* Table : INCLURE */
/*==============================================================*/
create table INCLURE
(
NUMTL char(10) not null,
constraint PK_INCLURE primary key (NUMTL)
);

/*==============================================================*/
/* Index : ASSOCIATION_2_PK */
/*==============================================================*/
create unique index ASSOCIATION_2_PK on INCLURE (
NUMTL ASC
);

/*==============================================================*/
/* Table : INFORMATIQUE */
/*==============================================================*/
create table INFORMATIQUE
(
NUM_INFO char(10) not null,
OUTLOOK varchar(60) not null,
SAP varchar(60) not null,
NOUR varchar(40) not null,
SYS_EXP varchar(40) not null,
MATERIEL varchar(20) not null,
constraint PK_INFORMATIQUE primary key (NUM_INFO)
);
0
Profil bloqué
 
/*==============================================================*/
/* Index : INFORMATIQUE_PK */
/*==============================================================*/
create unique index INFORMATIQUE_PK on INFORMATIQUE (
NUM_INFO ASC
);

/*==============================================================*/
/* Table : MATERIEL */
/*==============================================================*/
create table MATERIEL
(
NUM_INFO char(10) not null,
OUTLOOK varchar(60) not null,
SAP varchar(60) not null,
NOUR varchar(40) not null,
SYS_EXP varchar(40) not null,
MATERIEL varchar(20) not null,
ENTITE varchar(254) not null,
MATERIEL_EN_PANNE varchar(40) not null,
QUANTITE integer not null,
REPARATION smallint not null,
OBSERVATION varchar(254) not null,
constraint PK_MATERIEL primary key (NUM_INFO)
);

/*==============================================================*/
/* Index : MATERIEL_PK */
/*==============================================================*/
create unique index MATERIEL_PK on MATERIEL (
NUM_INFO ASC
);

/*==============================================================*/
/* Table : NOUR */
/*==============================================================*/
create table NOUR
(
NUM_INFO char(10) not null,
OUTLOOK varchar(60) not null,
SAP varchar(60) not null,
NOUR varchar(40) not null,
SYS_EXP varchar(40) not null,
MATERIEL varchar(20) not null,
ENTITE varchar(254) not null,
NATURE_D_INTERVENTION varchar(254) not null,
NBRE_D_INTERVENTION integer not null,
VERSION integer not null,
OBSERVATION varchar(254) not null,
constraint PK_NOUR primary key (NUM_INFO)
);

/*==============================================================*/
/* Index : NOUR_PK */
/*==============================================================*/
create unique index NOUR_PK on NOUR (
NUM_INFO ASC
);

/*==============================================================*/
/* Table : OUTLOOK */
/*==============================================================*/
create table OUTLOOK
(
NUM_INFO char(10) not null,
OUTLOOK varchar(60) not null,
SAP varchar(60) not null,
NOUR varchar(40) not null,
SYS_EXP varchar(40) not null,
MATERIEL varchar(20) not null,
ENTITE_ varchar(60) not null,
NBRE_DE_DEMANDES integer not null,
CREER integer not null,
NBRE_D_INTERVENTIONS_ integer not null,
constraint PK_OUTLOOK primary key (NUM_INFO)
);

/*==============================================================*/
/* Index : OUTLOOK_PK */
/*==============================================================*/
create unique index OUTLOOK_PK on OUTLOOK (
NUM_INFO ASC
);

/*==============================================================*/
/* Table : RESEAU_LAN */
/*==============================================================*/
create table RESEAU_LAN
(
NUMTL char(10) not null,
WAN varchar(40) not null,
LAN varchar(60) not null,
TELEPHONIE_ varchar(50) not null,
FAX varchar(60) not null,
GSM varchar(20) not null,
DP varchar(60) not null,
SERVICE varchar(60) not null,
DATE_DEBUT integer not null,
DATE_FIN integer not null,
TYPE_ANOMALIE_ varchar(30) not null,
NBRE_D_INTERVENTIONS integer not null,
RESOLU smallint not null,
PROBLEME_DE_L_INSTANCE varchar(60) not null,
OBSERVATION varchar(254) not null,
constraint PK_RESEAU_LAN primary key (NUMTL)
);

/*==============================================================*/
/* Index : RESEAU_LAN_PK */
/*==============================================================*/
create unique index RESEAU_LAN_PK on RESEAU_LAN (
NUMTL ASC
);

/*==============================================================*/
/* Table : RESEAU_WAN */
/*==============================================================*/
create table RESEAU_WAN
(
NUMTL char(10) not null,
WAN varchar(40) not null,
LAN varchar(60) not null,
TELEPHONIE_ varchar(50) not null,
FAX varchar(60) not null,
GSM varchar(20) not null,
DP varchar(60) not null,
ENTITE_ varchar(60) not null,
NATURE varchar(60) not null,
DATE_DEBUT integer not null,
DATE_FIN integer not null,
INSTANCE integer not null,
"DATE" integer not null,
DATE_DE_RETABLISSEMENT integer not null,
RESOLU smallint not null,
constraint PK_RESEAU_WAN primary key (NUMTL)
);

/*==============================================================*/
/* Index : RESEAU_WAN_PK */
/*==============================================================*/
create unique index RESEAU_WAN_PK on RESEAU_WAN (
NUMTL ASC
);

/*==============================================================*/
/* Table : SAP */
/*==============================================================*/
create table SAP
(
NUM_INFO char(10) not null,
OUTLOOK varchar(60) not null,
SAP varchar(60) not null,
NOUR varchar(40) not null,
SYS_EXP varchar(40) not null,
MATERIEL varchar(20) not null,
DIVISION varchar(60) not null,
NBRE_DE_DEMANDES_ integer not null,
TYPE varchar(60) not null,
OBSERVATION varchar(254) not null,
constraint PK_SAP primary key (NUM_INFO)
);

/*==============================================================*/
/* Index : SAP_PK */
/*==============================================================*/
create unique index SAP_PK on SAP (
NUM_INFO ASC
);

/*==============================================================*/
/* Table : SYSTEME_D_EXPLOITATION */
/*==============================================================*/
create table SYSTEME_D_EXPLOITATION
(
NUM_INFO char(10) not null,
OUTLOOK varchar(60) not null,
SAP varchar(60) not null,
NOUR varchar(40) not null,
SYS_EXP varchar(40) not null,
MATERIEL varchar(20) not null,
ENTITE varchar(254) not null,
NBRE_D_INTERVENTION integer not null,
DIVISION varchar(60) not null,
OBSERVATION varchar(254) not null,
constraint PK_SYSTEME_D_EXPLOITATION primary key (NUM_INFO)
);

/*==============================================================*/
/* Index : SYSTEME_D_EXPLOITATION_PK */
/*==============================================================*/
create unique index SYSTEME_D_EXPLOITATION_PK on SYSTEME_D_EXPLOITATION (
NUM_INFO ASC
);

/*==============================================================*/
/* Table : TABLE_DES_ENTITES */
/*==============================================================*/
create table TABLE_DES_ENTITES
(
DP_CASA_ char(10) not null,
SUCCURSALE char(10) not null,
DRC char(10) not null
);

/*==============================================================*/
/* Table : TELECOM */
/*==============================================================*/
create table TELECOM
(
NUMTL char(10) not null,
WAN varchar(40) not null,
LAN varchar(60) not null,
TELEPHONIE_ varchar(50) not null,
FAX varchar(60) not null,
GSM varchar(20) not null,
constraint PK_TELECOM primary key (NUMTL)
);

/*==============================================================*/
/* Index : TELECOM_PK */
/*==============================================================*/
create unique index TELECOM_PK on TELECOM (
NUMTL ASC
);

/*==============================================================*/
/* Table : TELEPHONIE */
/*==============================================================*/
create table TELEPHONIE
(
NUMTL char(10) not null,
WAN varchar(40) not null,
LAN varchar(60) not null,
TELEPHONIE_ varchar(50) not null,
FAX varchar(60) not null,
GSM varchar(20) not null,
DP varchar(60) not null,
SERVICE_ varchar(60) not null,
DATE_DEBUT_ integer not null,
DATE_FIN_ integer not null,
RESOLU smallint not null,
NATURE_DE_L_INTERVETION_ varchar(254) not null,
constraint PK_TELEPHONIE primary key (NUMTL)
);
0
HostOfSeraphim Messages postés 6750 Date d'inscription   Statut Contributeur Dernière intervention   1 608
 
et voila le tout c trop long -_-"

C'est bien pour ça que j'avais dit "le début" ;-)

Bon, pas d'erreur de syntaxe, dans le même temps j'ai vérifié : sys.sysforeignkey n'existe pas sur MySQL. Tu n'aurais pas récupéré ton script d'une base SQL Server ou Sybase ?


0
Profil bloqué
 
Sybase
0
Profil bloqué
 
j'ai crée ma base de données sous Power AMC puis je l'ai vérifié et j'ai généré après le modèle physique de données et le script SQL
0
Profil bloqué
 
et j'ai exécuté ce script dans EasyPhp
0