Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Can't see Return Value

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2007-02-01 : 17:31:05
Hello,

I created a procedure which returns either 0 or 1.
When I run it I don't get anything in the Results Tab in MS SQL Server Management Studio.

Why?
How can I see what the result is?

Thanks,
Miguel

My Procedure:

-- Begin of procedure code
ALTER PROCEDURE [dbo].[by27_Levels_LevelExists]

-- Define the procedure parameters
@LevelName NVARCHAR(100)

AS
BEGIN

-- Allows @@ROWCOUNT and the return of number of records when ExecuteNonQuery is used
SET NOCOUNT OFF;

-- Check if LevelId is Not Null
IF (EXISTS (SELECT LevelName FROM dbo.by27_Levels WHERE LOWER(@LevelName) = LOWER(LevelName)))
Return (1)
ELSE
Return (0)

END

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-02-01 : 17:35:28
You would see the return if you execute the stored procedure like this:

DECLARE @rc tinyint
EXEC @rc = by27_Levels_LevelExists 'LevelNameValue'
PRINT @rc

I'd suggest using OUTPUT parameters instead of RETURN values though.

Tara Kizer
Go to Top of Page
   

- Advertisement -