zoukankan      html  css  js  c++  java
  • 批量导入表数据

    方法1:

      insert into select--->

      insert into tbl2  select id,treeLevel from tbl2

    方法2:

      select into from--->

      select id,treeLevel into tbl1 from tbl2

    示例:

    alter function dbo.tblForJson(@SuperMan varchar(50),@TreeDepth int)
    returns @tempSubGroup table(ID int identity(1,1),PersonName nvarchar(50),ParentID int,Treel int)
    as
    begin
        declare @i int   --树深度
        declare @tmpId int
        declare @curLevelInfo table(ParentID int,Person nvarchar(50))  --当前层
    
        set @i=0
        insert @tempSubGroup values(@SuperMan,0,@i) 
        while @i<@TreeDepth-1
        begin
            delete from @curLevelInfo
            insert into @curLevelInfo select ID,PersonName from @tempSubGroup where treel=@i 
            set @i=@i+1;
            insert into @tempSubGroup select junior,ParentID,@i from PTS_SubGroup 
            inner join Person on junior=Name right join @curLevelInfo on superior=Person 
            where superior=Person and treeLevel=1 and Coding=1
        end
        return
    end

      

  • 相关阅读:
    AGC015E Mr.Aoki Incubator
    luogu P3520 [POI2011]SMI-Garbage
    442.Find All Duplicates in an Array
    SICP_2.61-2.62
    sicp_2.59-2.60
    SICP_2.58
    SICP_2.56-2.57
    SICP_2.53-2.55
    SICP_2.52-2.53
    SICP_2.50-2.51
  • 原文地址:https://www.cnblogs.com/kedarui/p/3625493.html
Copyright © 2011-2022 走看看