Advertisement
Advertisement
| 07.02.2008 at 02:19PM PDT, ID: 23535174 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: |
/****** Object: Stored Procedure dbo.sp_CH1GradeType Script Date: 4/21/00 12:54:30 PM ******/ CREATE Procedure sp_CH1GradeType As declare tempcur cursor for select s.objid ,coalesce(cs.x_6_enrollment, 0) as x_6_enrollment ,coalesce(cs.x_7_enrollment, 0) as x_7_enrollment ,coalesce(cs.x_8_enrollment, 0) as x_8_enrollment ,coalesce(cs.x_9_enrollment, 0) as x_9_enrollment ,coalesce(cs.x_10_enrollment, 0) as x_10_enrollment ,coalesce(cs.x_11_enrollment, 0) as x_11_enrollment ,coalesce(cs.x_12_enrollment, 0) as x_12_enrollment from table_site s join table_conv_site cs on cs.conv_site2site = s.objid where (x_grade_type is null or x_grade_type = '') and x_network = 'CH1' and status = 0 for read only open tempcur declare @M int ,@H int ,@6th int ,@7th int ,@8th int ,@9th int ,@10th int ,@11th int ,@12th int ,@ObjectID int fetch next from tempcur into @objectid, @6th,@7th,@8th,@9th,@10th,@11th,@12th while @@fetch_status <> -1 begin select @M = 0 select @H = 0 if @6th > 0 select @M = 100 if @7th > 0 select @M = @M + 1 if @8th > 0 select @M = @M + 1 if @9th > 0 select @H = @H + 1 if @10th > 0 select @H = @H + 1 if @11th > 0 select @H = @H + 1 if @12th > 0 select @H = @H + 1 if @M <> 0 or @H <> 0 begin if @M >= @H update table_site set x_grade_type = 'M' where objid = @objectid else update table_site set x_grade_type = 'H' where objid = @objectid end fetch next from tempcur into @objectid, @6th,@7th,@8th,@9th,@10th,@11th,@12th end close tempcur deallocate tempcur return GO |