Results 1 to 5 of 5

Thread: SQL Query

  1. #1
    Join Date
    May 2008
    Posts
    1

    SQL Query

    Hello,

    I am trying to analyze 56 years of hourly rainfall data.

    Right now i have three columns. Date(mm/dd/yyyy), hr(0-23) and hourly Rainfall(inches).

    I would like to know the count of rainfall events that exceed 2.4 inches in 24 hrs.

    once an event is identified the next event should be identified with a gap of 72 hours.

    Any suggestions on how to query this?

    Thanks,

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    1. Algorithm should be like this
    select * into Mytemptable from myraintable where rainfall>2.4

    2. CURSOR on mytemptable and a little programming find if the Fetch next is less then 72 hours. If yes, delete that row.

    3. select count(*) from mytemptable.

  3. #3
    Join Date
    May 2008
    Posts
    1
    hi i am getting an error while executing this query.can somebody plsss help me immediately on this.

    CREATE TABLE Metric
    (MetricID int primary key not null,
    CommitmentID int references TresuryCommitment(Commitmentid) not null,
    UnitID int references unit(unitid) not null,
    MetricName nvarchar(50) not null,
    MetricDescription nvarchar(200) ,
    TeamName nvarchar(20) not null,
    FrequencyID int references frequency(frequencyid) not null,
    Target double,
    TargetDescription nvarchar(200),
    TargetHoverText nvarchar(200),
    IndicatorHoverText nvarchar(200),
    OwnerID int references person(personnelnumber)not null,
    PrimaryDelegate int references person(personnelnumber),
    SecondaryDelegate int references person(personnelnumber),
    CreatedDate Datetime,
    UpdatedDate timestamp,
    UpdatedBy int references person(personnelnumber),
    InfoChangeNumber int,
    MetricStatus nvarchar(20)
    );
    requirwes quick help plssss.

  4. #4
    Join Date
    Jun 2004
    Location
    Atlanta and Manhattan
    Posts
    607

    Are you asking a separate question on another's thread?

    Seems a strange followup to the existing thread...

    Bill
    Last edited by Island1; 05-26-2008 at 01:02 PM. Reason: Spelling Error

  5. #5
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    There is no "double" data type in SQL Server. try this

    CREATE TABLE Metric
    (MetricID int primary key not null,
    CommitmentID int references TresuryCommitment(Commitmentid) not null,
    UnitID int references unit(unitid) not null,
    MetricName nvarchar(50) not null,
    MetricDescription nvarchar(200) ,
    TeamName nvarchar(20) not null,
    FrequencyID int references frequency(frequencyid) not null,
    Target bigint,
    TargetDescription nvarchar(200),
    TargetHoverText nvarchar(200),
    IndicatorHoverText nvarchar(200),
    OwnerID int references person(personnelnumber)not null,
    PrimaryDelegate int references person(personnelnumber),
    SecondaryDelegate int references person(personnelnumber),
    CreatedDate Datetime,
    UpdatedDate timestamp,
    UpdatedBy int references person(personnelnumber),
    InfoChangeNumber int,
    MetricStatus nvarchar(20)
    );

Posting Permissions

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