Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2005
    Location
    SW England
    Posts
    102

    Unanswered: please check this SP syntax - need more eyes!

    when I try to create this SP I get: "incorrect syntax near @MyResult"
    I have tried INT and different variable names, but get same error.

    Code:
    CREATE PROCEDURE sp_IsValidLogon
      @UserName  varchar(16),
      @Password  varchar(16) ,
      @MyResult  varchar(3) OUTPUT
    As
    if exists(Select * From User_Table
              Where UserName = @UserName
                            And
                    Password = @Password)
      begin
           @MyResult = 1
      end
    else
      begin
        INSERT INTO FailedLogons(UserName, Password)
            values(@UserName, @Password)
    
        declare @totalFails  int
        Select @totalFails = Count(*) From FailedLogons
            Where UserName = @UserName
            And dtFailed > GetDate()-1
    
        if (@totalFails > 5)
          UPDATE User_Table Set Active = 0
          Where UserName = @UserName
    
        @MyResult = 0
      end
    Last edited by darkmunk; 09-13-07 at 07:25.

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    The answer is
    Code:
    SET @MyResult = ...
    George
    Home | Blog

  3. #3
    Join Date
    Oct 2005
    Location
    SW England
    Posts
    102

    Talking

    Thanks George,
    That's sorted it.
    I seem to have two threads in this forum now tho' sorry guys.

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    No worries - I will remove the dupe
    George
    Home | Blog

Posting Permissions

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