zoukankan      html  css  js  c++  java
  • 本地临时表“#” 与 全局临时表 "##"

    在写查询时,我们会经常用到临时表来存储数据,介绍下临时表的使用以及有效范围。

    (1)临时表以“#”开头,而临时表又分为局部临时表与全局临时表,一个“#”即为局部临时表,两个“#”即为全局临时表。

    (2)局部临时表只对当前连接有效当前连接断开自动删除。 

       全局临时表对其它连接也有效,在当前连接其他访问过它的连接断开时自动删除。


    下面分别简单介绍一下,都已要给客户主数据创建临时表为例:

    1、局部临时表
     (1)--创建局部临时表 #BPClt

         select * into #BPClt from BPClt

      

     (2)--查询局部临时表

         --注意:局部临时表只对当前连接有效,切换到其它连接不能使用,且当前连接断开时自动删除。

         select * from #BPClt

      

     

    局部临时表新的连接,无法查询到临时表。只对当前连接有效


     (3)--删除局部临时表

         Drop Table #BPClt


    2、全局临时表
     (1)--创建全局临时表 ##BPClt

         select * into ##BPClt from BPClt

     

     (2)查询全局临时表

        --注意:全局临时表对其它连接也有效,在当前连接和其他访问过它的连接都断开时自动删除。

        select * from ##BPClt

     


     

     (3)--删除全局临时表

         Drop Table #BPClt

     

      转:https://blog.csdn.net/push1999/article/details/70210905
  • 相关阅读:
    python模块
    Django基础
    Python __str__(self)和__unicode__(self)
    Redis基本操作
    测试面试宝典
    h5页面的测试方式
    selenium IDE的使用流程
    如何安装chrome扩展程序--selenium IDE
    Selenium 中 强制等待、显示等待、隐式等待的区别
    Selenium+Python 自动化 之八种元素定位方法
  • 原文地址:https://www.cnblogs.com/wangzhening6/p/13992599.html
Copyright © 2011-2022 走看看