Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2005
    Location
    Zurich Switzerland
    Posts
    17

    Exclamation Unanswered: This Function Won't Work

    Hi! all
    Can any body help me straighten this function. Just need to get the diffrence between the two time frame in Minutes

    CREATE proc setup_DataReport

    as
    Declare @rc1 int

    Declare @rc2 int
    Declare @result int

    SELECT @rc1 =count(AL_Coming)
    FROM Alarm_Log

    where convert(char(5),AL_Coming,14) between '09:00' and '10:00' AND
    AL_State = 0

    SELECT @rc2 = count(AL_Coming)
    FROM Alarm_Log

    where convert(char(5),AL_Coming,14) between '09:00' and '10:00' AND
    AL_State = 1

    select @rc1 as a
    select @rc1 as a

    set @result = sum(@rc1 - rc2)
    print @result

    go
    Programming could be Addictive!!!

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    where datepart(hour, AL_Coming) = 9

    This includes everything from 9:00 am up to but not including 10:00 sharp.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Aug 2003
    Location
    Delft, The Netherlands (EU)
    Posts
    447
    See Thread
    Make everything as simple as possible, but not simpler! - A. Einstein
    DB Problems? DB Explorer, BTrieve Re-engineering, DB Conversions & ETL? Conversion Tool

Posting Permissions

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