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.
| Author |
Topic |
|
ramu.sql
Starting Member
5 Posts |
Posted - 2009-05-08 : 01:14:21
|
| declare @hr intdeclare @hr1 varchar(2) SET @hr = 0WHILE @hr < 24beginselect @hr1 =@hr + 1select @hr1 =right('0'+ltrim(str(@hr1,2)),2)insert into LM_UK_Zerobalance_hourlyselect distinct a.msisdn , a.firstusgdd,a.firstusgmm,a.firstusgyyyy , a.firstusghh---INTO LM_UK_Zerobalance_hourlyfrom MVNOREPORT_GBR.dbo.FirstUsageGBR_hourly a (nolock) , mvnoreport_gbr..view_Mstmvnoaccount b where a.msisdn = b.mobilenoand a.firstusgdd=datepart(dd,getdate() )and a.firstusgmm=datepart(mm,getdate() )and a.firstusghh=@hrand 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 + 1endwhen 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 |
 |
|
|
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? |
 |
|
|
|
|
|
|
|