【问题标题】:#temp_table vs user.#temp_table sybase_iq#temp_table 与用户。#temp_table sybase_iq
【发布时间】:2018-04-16 06:04:14
【问题描述】:

我想知道#temp_table 和user.#temp_table 有什么区别

 -- 1) #Tem_table

  create table #temp_table
   ( id integer null);

 select * from #temp_table  -- find

select * from sysobjects where name = '#temp_table'-- not found

-- 关闭我的客户端

 select * from #temp_table -- not found

--2) user.#temp_table
 create table user.#temp_table
   ( id integer null);

  select * from user.#temp_table  -- found


 select * from sysobjects where name = '#temp_table'  --  found

--关闭我的客户端

  select * from sysobjects where name = '#temp_table'  -- still exist

我的主要问题是,为什么

 select * from sysobjects where name = '#temp_table'

不返回任何内容,并且与用户一起。

  select * from sysobjects where name = '#temp_table'

返回信息。

【问题讨论】:

    标签: sql database temp-tables sap-iq


    【解决方案1】:

    当您添加 user_name.#Table_name 时,Sybase 会自动忽略 #。您正在创建的是普通用户表。事实上,如果你检查它

     select * from sysobjects where name = '#temp_table'
    

    类型应该是 'U' 这意味着您已经创建了一个用户表 = 根本不是临时表。

    最好的问候,恩里克

    【讨论】:

      猜你喜欢
      • 2015-08-06
      • 2011-04-12
      • 1970-01-01
      • 2014-01-26
      • 2018-11-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-12
      相关资源
      最近更新 更多