locked
return not returning RRS feed

  • Question

  • I was working on the stored procedure  which updating rows in the table . This stored procedure runs on VB 6 and return the number of rows effeted.
    The stored procdure itself   end   at    Return @Counter.  So this is fine.

    But when I tried to supply the parameters directly into sp,, it did not return me anything, it just said  completed successfully.
    I am using sqlserver  2005. 

    Just to test I did a lil test and I thought I would get some values but still did not get a single value, this is the example.
    CREATE PROCEDURE checkstate

     @param varchar(11)

    AS

    IF (SELECT state FROM authors WHERE au_id = @param) = 'CA'

        RETURN 1

    ELSE

        RETURN 2

    so what should I do?
    i am a novice and a student
    Saturday, May 23, 2009 5:06 AM

Answers

  • You need to do something with that value returned by the procedure. SQL Server doesn't "print" it for you.

    EXEC @myReturnVar = MyProc @p1, @p2, ...
    Tibor Karaszi
    Saturday, May 23, 2009 5:16 AM
  • This is how you call

    DECLARE @return_status int;
    EXEC @return_status = checkstate '2';
    SELECT 'Return Status' = @return_status;


    Madhu
    MCITP, MCTS, MCDBA,MCP-- Blog : http://experiencing-sql-server-2008.blogspot.com/
    Saturday, May 23, 2009 5:25 AM

All replies

  • You need to do something with that value returned by the procedure. SQL Server doesn't "print" it for you.

    EXEC @myReturnVar = MyProc @p1, @p2, ...
    Tibor Karaszi
    Saturday, May 23, 2009 5:16 AM
  • This is how you call

    DECLARE @return_status int;
    EXEC @return_status = checkstate '2';
    SELECT 'Return Status' = @return_status;


    Madhu
    MCITP, MCTS, MCDBA,MCP-- Blog : http://experiencing-sql-server-2008.blogspot.com/
    Saturday, May 23, 2009 5:25 AM