标签:div 判断 var 获取数据 dea 定义 int ice rom
DECLARE @Y1002 varchar(200),@A0100 varchar(200),@C0103 datetime ----定义变量 DECLARE Police_Department CURSOR FOR --定义游标 SELECT Y1002,A0100,C0103 FROM A001A000 WHERE LEFT(Y1002,1)=‘4‘ AND LaborState=1 ---查询的数据 OPEN Police_Department --打开游标 FETCH next from Police_Department into @Y1002,@A0100,@C0103 --将游标向下移1行,获取的数据放入之前定义的变量@@Y1002,@A0100,@C0103中,这个支段的数量要与查出的支段数量一致 WHILE @@fetch_status=0 --判断是否成功获取数据 BEGIN -----这里写代码逻辑块 FETCH NEXT FROM Police_Department into @Y1002,@A0100,@C0103 --将游标向下移1行 END CLOSE Police_Department --关闭游标 DEALLOCATE Police_Department --释放游标 ---游标可用于循环
标签:div 判断 var 获取数据 dea 定义 int ice rom
原文地址:https://www.cnblogs.com/Dainney/p/10317492.html