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 adjentlly please

Author  Topic 

ramu143
Yak Posting Veteran

64 Posts

Posted - 2008-05-15 : 02:15:38
Proc carrierauto1.0

Carrier_Test – Table containing the operator names.
Test_report – Output of the procedure for multiple reports is being stores in this table.



SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

/****** Object: Stored Procedure dbo.carrierTest Script Date: 14/05/2008 16:35:40 ******/
ALTER proc carrierauto --'2008','08','01','15'
@pYear int,
@pMonth int,
@pDay1 int,
@pDay2 int
As
Begin
Declare @pOperator varchar (32)
Delete from test_report
Set nocount on
DECLARE carname CURSOR
FOR select display name from carrier test (no lock)
Open carname
Fetch next from carname into @pOperator
While (@@fetch_status<>-1)
Begin
Insert into test report exec carr_summary_Datewise @pYear, @pMonth,@pDay1,@pDay2,@pOperator
Fetch next from carname into @pOperator
End
CLOSE carname
DEALLOCATE carname
Set nocount off
Select * from test_report (nolock)
end

GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

in the aboove prosedure with out giving day1 ,day2 just run aloop for weekly ,foradicly,monthly
through the sysdate please give me suggestion to do it


give me logic i can modify every thng please

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-05-15 : 02:33:29
first of all you dont need the cursor here

SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON
GO

/****** Object: Stored Procedure dbo.carrierTest Script Date: 14/05/2008 16:35:40 ******/
ALTER proc carrierauto --'2008','08','01','15'
@pYear int,
@pMonth int,
@pDay1 int,
@pDay2 int
As
Begin
Set nocount on
Declare @pOperator varchar (32)
Delete from test_report

select @pOperator = min(display name) from carrier test (no lock)

While (@pOperator is not null)
Begin
Insert into test report exec carr_summary_Datewise @pYear, @pMonth,@pDay1,@pDay2,@pOperator

select @pOperator = min(display name) from carrier test (no lock)
where [display name] >@pOperator

End

Set nocount off
Select * from test_report (nolock)
end

GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO


Now by running weekly do you mean passing a month value and running for all weeks of month? or do you want procedure to return you data of current week based on date in which it was run?
Go to Top of Page

ramu143
Yak Posting Veteran

64 Posts

Posted - 2008-05-15 : 02:38:28
Now by running weekly do you mean passing a month value and running for all weeks of month yes and also i pass 15 then i need to get 15 days

cursor is for check automatically operator name in Carrier_Test
Go to Top of Page

ramu143
Yak Posting Veteran

64 Posts

Posted - 2008-05-15 : 02:40:52
there they taken operator name in Carrier_Test like that we need to take another one w,f,m from there
Go to Top of Page

ramu143
Yak Posting Veteran

64 Posts

Posted - 2008-05-15 : 04:50:47
thnks and help me please vishaka
Go to Top of Page
   

- Advertisement -