Bonjour,
Je voudrais insérer, dans une table, la combinaison des toutes les valeurs possibles pour trois indicateurs.
Les trois indicateurs ont un intervalle de valeurs propre.
L’échelle des valeurs est de 0.25.
Pour l’instant je fais comme ceci :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Set @currentsphere = @spheremin set @currentcylinder = @cylindermin set @currentaddition = @additionmin set @scale = 0.25 BEGIN while(@currentsphere <= @spheremax) BEGIN SET @currentcylinder = @cylindermin while(@currentcylinder <= @cylindermax) BEGIN SET @currentaddition = @additionmin while(@currentaddition <= @additionmax) BEGIN insert into #TableUWS (sphere,cylinder,addition,weighted_sales,weight_per_sphere,user_weight_per_sphere,weight_per_cylinder,weight_per_addition,user_weighted_sales) values(@currentsphere,@currentcylinder,@currentaddition,0,0,0,0,0,0) Set @currentaddition = @currentaddition + @scale END Set @currentcylinder = @currentcylinder + @scale END Set @currentsphere = @currentsphere + @scale END END
Pour un exemple simple :
0 <= sphere <= 0.5
0.25 <= cylindre <= 0.5
0 <= addition <= 0.25
J’aurai comme résultat :
S C A
0 0.25 0
0 0.25 0.25
0 0.5 0
0 0.5 0.25
0.25 0.25 0
0.25 0.25 0.25
0.25 0.5 0
..... Et ainsi de suite
Sauf qu’en pratique les intervalles sont plus grand genre 0 à 10 et qu’avec ma méthode cela prend plus de 2minutes.
Pensez-vous qu'il existe une méthode plus efficace pour remplir ma table ?
Merci d'avance
Partager