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
| CREATE TABLE employe
(matricule numeric(9,0) primary key,
nom varchar(30) not null,
prenom varchar(30) not null,
age varchar(10) null, /* ??? pas un entier ??? */
ville varchar(30) null /* ??? pas un code pointant sur une table localite ??? */)
CREATE TABLE heuret
( id numeric(9,0) identity primary key /* ??? clé primaire nécessaire pour chaque table !!! */,
matricule numeric(9,0) references employe(matricule)
heures varchar(30) not null /* ??? pas un datetime ??? */)
CREATE PROC ins_emp
(@matricule numeric(9,0)=NULL,
@Heure varchar(30) = NULL,
@Nom varchar(30) = NULL,
@Prenom varchar(30) = NULL,
@Ville varchar(30) = NULL,
@Age varchar(10) = NULL,
as
begin
if not exists(select * from employe where matricule = @matricule)
BEGIN
/* Matricule inexistant*/
INSERT INTO employe
VALUES(@marticule, @nom, @prenom, @age, @ville)
END
INSERT INTO heuret (matricule, heure)
VALUES(@marticule, @heure)
END |
Partager