Loading ...
Sorry, an error occurred while loading the content.
 

Sproc Question

Expand Messages
  • Ryan Olshan
    I am using the below sproc to display locked out IP addresses and how many failed attempts. The only problem is, I need to figure out how to pass the distinct
    Message 1 of 1 , Aug 31, 2005
      I am using the below sproc to display locked out IP addresses and how many failed attempts. The only problem is, I need to figure out how to pass the distinct IP address selected in the 2nd query to the count function, and then in turn pass the TotalCount value back to the 2nd query.
       

      ALTER PROCEDURE dbo.GetApplicationLockout
       (
        @CurrentTime smalldatetime,
        @LockoutDuration int,
        @TotalCount int OUTPUT
       )
      AS
       SET NOCOUNT ON
       
       SET @TotalCount =
        (
         SELECT COUNT(Type)
         FROM LoginAudit
         WHERE ((Type = '0') OR (Type = '2')) AND (@CurrentTime BETWEEN [DateTime] AND DATEADD(hour, @LockoutDuration, [DateTime])) AND (Reset <> '1')
        )

       SELECT DISTINCT(IPAddr), TotalCount = @TotalCount
       FROM LoginAudit
       WHERE ((Type = '0') OR (Type = '2')) AND (@CurrentTime BETWEEN [DateTime] AND DATEADD(hour, @LockoutDuration, [DateTime])) AND (Reset <> '1')
       ORDER BY IPAddr ASC

       RETURN

      --
      Thank you,
      Ryan Olshan
      <asp:Web Programmer, Owner />
      TeraNet Systems
      http://www.teranetsystems.com

      --------Internet E-Mail Confidentiality Statement--------
      The content of and attachment(s) to this electronic transmission contains information from TeraNet Systems and is intended for the use of the person, firm or entity to which it is directed herein, and may contain information that is private, confidential, exempt from disclosure under applicable law, and/or proprietary to TeraNet Systems and is protected by law. If you are not the intended recipient, or the employee or agent responsible for delivering this message to the intended recipient, any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this message in error, please notify the sender, ryan@..., immediately by reply e-mail and delete the original message and any attachment(s) without reading or saving in any matter. Thank you for your cooperation.

    Your message has been successfully submitted and would be delivered to recipients shortly.