title: Return count in Stored Procedure
body: <p>I wrote a stored procedure to return a count. But I got a null value. Can anybody tell me where is the problem in my stored procedure. </p>
  
  <pre><code>set ANSI_NULLS ON
  set QUOTED_IDENTIFIER ON
  go
  
  ALTER PROCEDURE [dbo].[ValidateUser]
  @UserName varchar(50),
  @Password varchar(50),
  @Num_of_User int output
  
  AS 
  BEGIN
    SET NOCOUNT ON;
  
    SELECT @Num_of_user =COUNT(*) 
      FROM login
     WHERE username = @UserName 
       AND pw = @Password
  
    RETURN
  
  END
  </code></pre>