Bonjour à tous,

je voudrais vos conseils pour savoir si il possible de réaliser un script sql.

Si oui, comment doit début mon script, comment le constituer?

- j'ai les requêtes (ci-dessous)
- l'ordre exécution mais je sais pas comment procéder .


1er étape: une requête de départ qui récupère une liste de nom_catégorie (+ code) d'une table:

(GroupoCliente est forcement un chiffre)

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
Select distinct GroupoCliente, tgAgrupCliente.Descrip
From taDctoVenta 
Left Outer Join  tgAgrupCliente on (tgAgrupCliente.codigo = taDctoVenta .GrupoCliente)
where emp in ('001','002','003','004','005','006','007') and GrupoCliente IS NULL
2ème: création des barèmes de remises:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
insert into tgBaremoDcto (Codigo, Descrip,Estaller,EsAlmacen) VALUES (GroupoCliente+100,tgAgrupCliente.Descrip,'1','1')
3ème mise à jour table client:
a. Champ A
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
update tgClienteFac set tgClienteFac.AlmBaremoDcto = (tgClienteFac.AlmAgrupCliente +100) 
where tgClienteFac.Emp IN('001','002','003,'004','005','006','007') 
and tgClienteFac.AlmAgrupCliente=GroupoCliente 
and tgClienteFac.AlmBaremoDcto IS NULL
b.Champ B
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
update tgClienteFac set tgClienteFac.TallBaremoDcto = (tgClienteFac.TallAgrupCliente +100) 
where tgClienteFac.Emp IN('001','002','003,'004','005','006','007') 
and tgClienteFac.TallAgrupCliente=GroupoCliente 
and tgClienteFac.TallBaremoDcto IS NULL)
4ème mise à jour de la table de départ:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
update taDctoVenta set BaremoDcTo= (GrupoCliente +100), GrupoCliente='' 
where taDctoVenta.EMP IN('001','002','003,'004','005','006','007')
and taDctoVenta.GrupoCliente=GroupoCliente
merci d'avance pour vos conseils et vos explications

guigui69