0

bonjour, when executing a stored procedure, i have got my result and a return value with 0, i know that 0 seem to be no error when executing, but, i dont wanted that.

return value 0

here is my code, where or how can i solve that please?

USE [Active]
GO
/****** Object:  StoredProcedure [dbo].[PS_BR_listeProjetUneEntreprise]Script Date: 11/04/2018 13:39:10 ******/
SET ANSI_NULLS ON
GO
 SET QUOTED_IDENTIFIER ON
GO
  -- =============================================
  -- Author:        BR
  -- Create date: 11/04/2018
  -- Description:   liste des projets d'une entreprise donnée
  -- =============================================
ALTER PROCEDURE [dbo].[PS_BR_listeProjetUneEntreprise] 
-- Add the parameters for the stored procedure here
@nomClient varchar(55)
AS
BEGIN
  -- SET NOCOUNT ON added to prevent extra result sets from
  -- interfering with SELECT statements.
  SET NOCOUNT ON;

  -- Insert statements for procedure here
  select [dbo].[PROJET].nomProjet, [dbo].[CLIENT].raisonSociale
  from [dbo].[PROJET]
  join [dbo].[CLIENT]
  on [dbo].[PROJET].idClient = [dbo].[CLIENT].idClient
  where [dbo].[CLIENT].raisonSociale like @nomClient
END

i am using sql server management studio 17

9
  • 2
    If you don't want 0, what do you want? Commented Apr 11, 2018 at 12:01
  • 1
    0 is just it returned your values. What do you want ? Commented Apr 11, 2018 at 12:01
  • 4
    For returning single scalar values, don't use RETURN, use OUTPUT. "I don't want to" isn't a very technical reason to break convention. Commented Apr 11, 2018 at 12:02
  • 1
    Where are you seeing the return value that you don't want it? Please describe your problem better. Calling this procedure, as is, does not produce this Return Value column you're showing in SSMS. That must be coming from somewhere else. Commented Apr 11, 2018 at 12:02
  • 1
    You're screenshot is showing at least 3 columns but the stored procedure is only returning two. Are you looking at the wrong stored proc? Commented Apr 11, 2018 at 12:09

1 Answer 1

1

After looking at the output image, I feel like you are executing your SP using SSMS like below query.

USE [Active]
GO    
DECLARE @return_value INT
DECLARE @nomClient varchar(55) ='abc'    
EXECUTE @return_value = [dbo].[PS_BR_listeProjetUneEntreprise] @nomClient    
SELECT  @return_value

Above is the standard template used when you use generate script option for executing a SP.

You can run it without return value also like following.

USE [Active]
GO    
DECLARE @nomClient varchar(55) ='abc'
EXECUTE  [dbo].[PS_BR_listeProjetUneEntreprise] @nomClient

This way you will not get additional record.

Sign up to request clarification or add additional context in comments.

1 Comment

i will try, thanx you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.