Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SQL - Create procedure error??????

    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

  • #2
    Regular Coder
    Join Date
    Feb 2005
    Location
    UK
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts
    my first guess would be to remove the space between @ and Num_of_User


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •