Bonjour,
Voilà la procédure

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
USE [LEHI]
GO
/****** Object:  StoredProcedure [dbo].[BeneficeVente]    Script Date: 11/09/2015 13:00:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[BeneficeVente] (@DateDebut as Date,@DateFin as Date,@NomElt as nvarchar,@Carburant as Bit,@TypeEtatParJour as bit)
	-- Add the parameters for the stored procedure here
	AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
 
    -- Insert statements for procedure here
 
	BEGIN
	select dateoperation as Elt,sum(vente) as Vte,sum(achat) as Ach,sum(vente-achat) as Benef,cast(@DateDebut as nvarchar)+' au '+cast(@DateFin as nvarchar) As Periode,upper(@NomElt) as NomElt,(select sum(sortie) as D from mvt_caisse where (dateoperation between @DateDebut and @DateFin)) as Depense from benefice where (dateoperation between @DateDebut and @DateFin) and (carb=@Carburant) group by dateoperation
	END
END
lorsque j'exécute, voilà le resultat

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
USE [LEHI]
GO
 
DECLARE	@return_value int
 
EXEC	@return_value = [dbo].[BeneficeVente]
		@DateDebut = 01/01/2015,
		@DateFin = 31/01/2015,
		@NomElt = N'DD',
		@Carburant = 0,
		@TypeEtatParJour = 0
 
SELECT	'Return Value' = @return_value
 
GO
et le message d'erreur suivant:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
Msg*102, Niveau*15, État*1, Ligne*5
Syntaxe incorrecte vers '/'.
Si quelqu'un peut m'aider. j'ai toujours buté sur les procédures stockées et pourtant je veux les maitriser à fond