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
 sp

Author  Topic 

ramu143
Yak Posting Veteran

64 Posts

Posted - 2008-05-13 : 07:00:52
ALTER proc carrierTest --2008,8,7
@pYear int,
@pMonth int,
@pDays int
as
begin
declare @pOperator varchar(32)
declare @pDay1 int
declare @pDay2 int
create table #temp5 (callyy int,Callmm int, Calldd int,Prefix varchar(50),Zone varchar(50),TimeCls varchar(15),Operatorout varchar(30),Talktime float,Cost float)
set @pDay2 = convert(int, DATEPART(DAY,getdate()));
set @pDay1 = @pDay2 - @pDays;
DECLARE carname CURSOR
FOR select displayname from carrier_test
open carname
fetch next from carname into @pOperator
while(@@fetch_status<>-1)
begin
insert into #temp5 exec carr_sum_Mar08_timediff_Datewise_withPrefix @pYear,@pMonth,@pDay1,@pDay2,@pOperator
fetch next from carname into @pOperator
end
CLOSE carname
DEALLOCATE carname
select * from #temp5
drop table #temp5
end



set @pDay2 = convert(int, DATEPART(DAY,getdate()));
set @pDay1 = @pDay2 - @pDays;
i need logic for time also gmt timings

send me logic

nr
SQLTeam MVY

12543 Posts

Posted - 2008-05-13 : 07:04:00
>> i need logic for time also gmt timings
not sure what you mean.

Datepart returns an int so you don't need that convert.

I take it you can't change the SP which is why you are looping.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

ramu143
Yak Posting Veteran

64 Posts

Posted - 2008-05-13 : 07:05:52
dont know explain me
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2008-05-13 : 07:08:08
Which time / timings are you talking about?

convert(varchar(8),getdate(),108) maybe?


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-13 : 07:24:25
use GETUTCDATE function instead of GETDATE() to get GMT times
Go to Top of Page
   

- Advertisement -