sql - #temp_table 与用户。#temp_table sybase_iq

标签 sql database temp-tables sap-iq

我想知道#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'

返回信息。

最佳答案

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

 select * from sysobjects where name = '#temp_table'

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

最好的问候,恩里克

关于sql - #temp_table 与用户。#temp_table sybase_iq,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47096911/

相关文章:

php - Paypal api成功或失败

database - 使用 etcd 作为主要存储/数据库?

java - 无法使用 hibernate 5.0 将 List<String> 插入到 postgres 9.4 表中,其中要插入的列的类型为字符 varying[]

mysql - 使用临时表的问题

sql-server - SQL : use ID's in temp table to query another table

c# - 使用 SQL 身份验证处理连接字符串

mysql - 如何在 SQL 中找到列的模式?

sql - 如何更改 hierarchyid 中子项和子项的父 ID

java - 如何将 @ManyToOne 关联映射到 SQL 查询的结果

oracle - 临时表与永久表