When I tried to create this procedure. I received an error - at line "SET @ Num_of_User = (SELECT COUNT(*) AS Num_of_User" It said that " Server: Msg 170, Level 15, State 1, Procedure sp_ValidateUser, Line 8
Line 8: Incorrect syntax near 'Num_of_User'."
Does anyone know why? Thanks for your help.
CREATE PROCEDURE sp_ValidateUser
(
@UserName VARCHAR(50) = NULL,
@Password VARCHAR(50) = NULL,
@Num_of_User INT = 0
)
AS
SET @ Num_of_User = (SELECT COUNT(*) AS Num_of_User
FROM NorthWindUsers
WHERE UserName = @UserName AND Password = @Password)
RETURN @Num_of_User
my first guess would be to remove the space between @ and Num_of_User