下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。
内存溢出小编现在分享给大家,也给大家做个参考。
create procedure proc_deptasdeclare @cursor cursor,@ID varchar(50),@pID varchar(100)begin set @cursor = cursor for select deparet_ID,parent_deparet_ID from dbo.tb_department_tree order by sequence; open @cursor fetch next from @cursor into @ID,@pID; while(@@FETCH_STATUS = 0) begin if(@pID is null) begin update tb_department_tree set scope = @ID,tlevel = 1,tpath = @ID where deparet_ID = @ID; end else begin update tb_department_tree set tlevel = (select tlevel from tb_department_tree where deparet_ID = @pID)+1,tpath = (select tpath from tb_department_tree where deparet_ID = @pID)+'-'@L_502_0@ where deparet_ID = @ID; update tb_department_tree set scope =(select SUBSTRING(tpath,CHARINDEX('-',tpath,0)) from tb_department_tree where deparet_ID = @ID) from tb_department_tree where deparet_ID = @ID; end; fetch next from @cursor into @ID,@pID; end; close @cursor;end;exec proc_dept;drop procedure proc_dept;
以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
总结以上是内存溢出为你收集整理的按照一定规则批量修改表中新增字段的值全部内容,希望文章能够帮你解决按照一定规则批量修改表中新增字段的值所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)