...

View Full Version : SQL - Create procedure error??????



ClueLess
03-29-2005, 08:09 PM
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

Noodles24
03-30-2005, 01:51 AM
my first guess would be to remove the space between @ and Num_of_User



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum