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 |
|
ramu143
Yak Posting Veteran
64 Posts |
Posted - 2008-04-30 : 05:23:45
|
| SET QUOTED_IDENTIFIER ON GOSET ANSI_NULLS ON GO/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 4/30/2008 2:25:41 PM ******/if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ostat_CDS_rpt47_2006]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[ostat_CDS_rpt47_2006]GO/****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 23/04/2008 11:26:14 ******//****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 22/04/2008 14:35:33 ******//****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 21/04/2008 11:46:08 ******//****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 16/04/2008 17:18:04 ******//****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 04/04/2008 12:44:34 ******//****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 31/03/2008 12:03:31 ******//****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 31/03/2008 11:11:07 ******//****** Object: Stored Procedure dbo.ostat_CDS_rpt47_2006 Script Date: 09/03/2008 14:31:30 ******/-- ostat_CDS_rpt47_2006 2008,03,17,17 CREATE procedure ostat_CDS_rpt47_2006 @pYear int, @pMonth int, @pDay1 int, @pDay2 int as begin declare @sql varchar(4000) declare @tb1 varchar(128) declare @tb2 varchar(128) set @tb1= 'margin..ncds0421' set @tb2='Report.dbo.ob_apr08' set @sql= ' insert into '+@tb2+' select yyyy,mm,dd,HH,sitecode,TrunkOut,SwitchCode,prefixCode,0 isCallback, cast(callcost as decimal (10,5)) cost,count(*) attempt, sum(case when connectflg=1 then 1 else 0 end) connected,sum(talktime) Talktime from '+@tb1+' where yyyy='+ltrim(str(@pYear))+' and mm='+ltrim(Str(@pMonth)) +' and dd between '+ltrim(Str(@pDay1))+' and '+ltrim(Str(@pDay2))+' and talktime >0 and trunkin is null group by yyyy,mm,dd,HH,sitecode,TrunkOut,SwitchCode,prefixCode,cast(callcost as decimal (10,5)) order by yyyy,mm,dd,HH,sitecode,TrunkOut,SwitchCode,prefixCode,cast(callcost as decimal (10,5)) ' --print (@sql) exec (@sql) end GOSET QUOTED_IDENTIFIER OFF GOSET ANSI_NULLS ON GO |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-30 : 05:33:06
|
| Exec ostat_CDS_rpt47_2006 @pYear =year value, @pMonth =month value, @pDay1 =1st day value, @pDay2 2nd day value |
 |
|
|
ramu143
Yak Posting Veteran
64 Posts |
Posted - 2008-04-30 : 05:40:24
|
| thnkive vishaka |
 |
|
|
|
|
|
|
|