SQL Server Performance

need help in the SP

Discussion in 'General Developer Questions' started by isa, Dec 15, 2006.

  1. isa New Member

    Hello everyone,
    i have a table Buyers in the SQL Server 2000, in this table i have the follwing fields

    Buyers
    BuyerID
    BuyerName
    LastTransactionDate
    RegistrationDate
    LastLoginDate
    LastPinChange

    i want to make a "Hourly Performance Chart", for this i want to make a Stored Procedure, for this, i need time in hourly basis and then i displayed a chart how many buyers are logined in to the system.

    e.g i want to see Todays Chart then in this i see in 9.00 am how many buyers logined to system , and at 10 ,11 so on , But if u see the structure of the table i have a REGISTRATION DATE ( in this i have date + time ) then tell me how i strip the time from this field and used in the SP.

    plz reply me asap
    Thanx in Advance.

    isa
  2. MohammedU New Member

    SELECT convert(Varchar(10), LastLoginDate, 101), datepart(hh,LastLoginDate) as LoginHrs, count(*) NoOfBuyers
    from buyers
    group by convert(Varchar(10), LastLoginDate, 101), datepart(hh,LastLoginDate)

    Mohammed U.
  3. Madhivanan Moderator

Share This Page