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
 regarding SP

Author  Topic 

ramu143
Yak Posting Veteran

64 Posts

Posted - 2008-05-16 : 03:12:48
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

CREATE proc CPROC_15PLUS -- '2008','04','01','15'
@pYear int,
@pMonth int,
@pDay1 int,
@pDay2 int
as
begin

declare @pOperator varchar(32)

set nocount on
DECLARE carname CURSOR
FOR select displayname from CLIST_15PLUS(nolock)
open carname
fetch next from carname into @pOperator
while(@@fetch_status<>-1)
begin
insert into CDATA_15PLUS
--SELECT * INTO [CDATA_7PLUS'+@pDay1+''-''+@pDay2+''+@pYear+'] FROM
exec carr_summary_Datewise @pYear,@pMonth,@pDay1,@pDay2,@pOperator
fetch next from carname into @pOperator
end
CLOSE carname
DEALLOCATE carname
set nocount off
end
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO


when ever i am executing this procedure its taking more time

give me any modification in this one fro faster running

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-16 : 04:28:21
I can one possible improvemnt can be using WHILE loop instead of cursor. Also what does the sp carr_summary_Datewise do?
Go to Top of Page

ramu143
Yak Posting Veteran

64 Posts

Posted - 2008-05-16 : 04:44:55
carr_summary_Datewise throgh this sp they are geeting data daily report
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-16 : 05:15:38
quote:
Originally posted by ramu143

carr_summary_Datewise throgh this sp they are geeting data daily report


Have you executed it individually and checked how long it takes?
Go to Top of Page
   

- Advertisement -