Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 please check it hourly how to update

Author  Topic 

ramu.sql
Starting Member

5 Posts

Posted - 2009-05-08 : 01:14:21
declare @hr int
declare @hr1 varchar(2)
SET @hr = 0
WHILE @hr < 24
begin
select @hr1 =@hr + 1
select @hr1 =right('0'+ltrim(str(@hr1,2)),2)
insert into LM_UK_Zerobalance_hourly
select distinct a.msisdn , a.firstusgdd,a.firstusgmm,a.firstusgyyyy , a.firstusghh
---INTO LM_UK_Zerobalance_hourly
from MVNOREPORT_GBR.dbo.FirstUsageGBR_hourly a (nolock) , mvnoreport_gbr..view_Mstmvnoaccount b
where a.msisdn = b.mobileno
and a.firstusgdd=datepart(dd,getdate() )
and a.firstusgmm=datepart(mm,getdate() )
and a.firstusghh=@hr
and a.firstusgyyyy=datepart(yyyy,getdate() )
and b.tariffclassname in ( 'PPS_002', 'PPS_004','PPS_006')
--and year =datepart(yyyy,getdate() -1)
--and hours=@hr
---and convert(varchar(10),date,20)=convert(varchar(10),getdate() -1,20)
set @hr =@hr + 1
end



when ever running this one it will give total hours up to till hour.

i want to shcedule this one hourly basis if i schedule this one 4 a.m it should give 2-3 hour data or 1-2 hour data

please help me.

ramu.sql
Starting Member

5 Posts

Posted - 2009-05-08 : 01:29:10
in this table we are having the data every hour 4th hour we will have 3-4 data at 4.00 am

table name is FirstUsageGBR_hourly where this table is using in qurey
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-05-08 : 10:31:53
are firstusghh,firstusgdd,.. integer fields storing day, hour,...part of date?
Go to Top of Page
   

- Advertisement -