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 do it

Author  Topic 

ramu143
Yak Posting Veteran

64 Posts

Posted - 2008-05-13 : 06:02:24
declare @cname varchar(30)
create table #temp5 (callyy int,Callmm int, Calldd int,Prefix int,Zone varchar(50),TimeCls varchar(15),Operatorout varchar(30),Talktime float,Cost float)
DECLARE carname CURSOR
FOR select displayname from carrier_test
open carname
fetch next from carname into @cname
while(@@fetch_status<>-1)
begin

insert into #temp5 exec carr_sum_FEB08_timediff_PreviousMonth_Datewise_withPrefix_minus '2008','02','29','29',@cname

fetch next from carname into @cname
end
CLOSE carname
DEALLOCATE carname



for this sp i need write a logic before forloop to generate a report sysdate before 7 days and sysdate to before 15 days and sysdate to before i month

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-05-13 : 06:11:02
All you need is a tally table with prestored numbers or dates.
Then you easily can fetch the records you want (-7 days, -15 days and so on).



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -