CREATE PROCEDURE getDpCount AS
/* declare local variables used for fetch */
declare @strPlanTestNo varchar(50)
declare @dpCount int
/* declare the cursor to get the count of datapoints for each test number */
declare dpcount cursor for
Select count(intDatapointID) as dpcount, strTestNo from tblDatapoints where strTestNo = @strPlanTestNo
Group by strTestNo
open dpcount
FETCH NEXT FROM dpcount
into @dpCount, @strPlanTestNo
while (@@FETCH_STATUS = 0)
begin
Update tblPlan set intPlanDpCount= @dpCount
WHERE strPlanTestNo = @strPlanTestNo
FETCH NEXT FROM dpcount
into @dpCount
end
CLOSE dpcount
DEALLOCATE dpcount
Select intPlanDpCount from tblPlan
GO
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
