zoukankan      html  css  js  c++  java
  • 利用with关键字实现数据查询的递归调用

    declare @sysCode nvarchar(50)
    declare @re table(id nvarchar(50),[level] int)   
    set @sysCode = '001';
    with cte as (
    select id,0 as [level] from T_SYS_Module
    where code =@sysCode
    union all
    select t1.id,t2.[level]+1 from T_SYS_Module t1,cte t2
    where t1.parentId=t2.id
    )
    insert  @re
    select * from cte
  • 相关阅读:
    xml配置文件使用-读取、转换
    .NET 4.0 缓存
    jQuery分页插件pagination.js 笔记
    Spring源码
    Shell编程(字符串篇)
    Linux DNS 相关
    Shell将命令执行结果写入文件
    Linux安装GCC
    Linux网络安全
    产品经理基础
  • 原文地址:https://www.cnblogs.com/poissonnotes/p/2352828.html
Copyright © 2011-2022 走看看