Bonjour tout le monde j'ai un probleme dans une fonction qui retourne un tableau
lorsque je met le code qui se trouve dans la fonction tout seul ca fonctionne a merveille mais lorsque je fait créer la fonction avec ce code ca fonctionne mais la fonction retourne un tableau qui est vide
Voilà le code sans fonction qui retourne un tableau qui n'est pas vide :
Avec la fonction la ou il ya le problème :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 select Projet.NomP, dbo.retournerniveau(Participation.CdeP) from Participation join Projet on Projet.CodeP = Participation.CdeP where Participation.Matr=1
==> resultat table vide
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 create function retourntable ( @matriculeEmploye int ) returns @toto table(NomP varchar(25),NiveauR decimal(11,2)) as begin declare @tempo table(NommP varchar(25) ,NiveauuR decimal(11,2)) insert into @tempo select Projet.NomP, dbo.retournerniveau(Participation.CdeP) from Participation join Projet on Projet.CodeP = Participation.CdeP where Participation.Matr=@matriculeEmploye return end
comment resoudre ce probleme ?
------Edit-------------
Lorsque j'ai essayé de faire ma fonction de cette façon
il a fonctionné a merveille
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 create function retable ( @matriculeEmploye int ) returns table as return( select Projet.NomP as 'nom Projet', dbo.retournerniveau(Participation.CdeP) as 'Niveau R' from Participation join Projet on Projet.CodeP = Participation.CdeP where Participation.Matr=@matriculeEmploye )
maintenant j'ai corrigé le problème par moi même
s'il vous plait pouvez vous me dire le problème de l'autre fonction ...
Partager