zoukankan      html  css  js  c++  java
  • 临时表

    创建临时表格式:
    1)

    create table TempTableName
    (
    ID int IDENTITY (1,1) not null,
    a1 varchar(50),
    a2 varchar(50),
    a3 varchar(50),
    primary key (ID) --定义ID为临时表#Tmp的主键
    )

    2)select [字段1,字段2,...,] into #Tmp from table


    查询临时表的数据 select * from #Tmp


    删除临时表 drop table #Tmp

    应该是全局临时表和本地临时表,全局临时表可以被创建临时表的连接和其它连接同时访问,本地临时表只能被创建这个临时表的连接所访问。
    全局临时表的表名以##开头,比如##、##a、##1等都是合法的全局临时表表名;
    本地临时表以#开头,比如#、#a、#1都是合法的本地临时表表名。

        create function GetRecursion(@id int)  
        returns @t table(  
            id int,  
            name varchar(50),  
            parentid int  
        )  
        as  
        begin  
            insert @t select * from recursion where >    while @@rowcount>0  
                insert @t select a.* from recursion as a inner join @t as b  
                on a.parentid=b.id and a.id not in(select id from @t)  
        return  
        end 

  • 相关阅读:
    VS自带的dbghelp.h文件 报错
    Windows 自带的截屏功能
    CentOS 7 安装
    Windows 远程连接 CentOS 7 图形化桌面
    <<、|=、&的小例子
    pip 安装库过慢
    pip -i 和 -U 参数
    windows下安装TA-Lib库
    vector、map 判断某元素是否存在、查找指定元素
    vector push_back报错
  • 原文地址:https://www.cnblogs.com/zhangweixin/p/4045717.html
Copyright © 2011-2022 走看看