#temp_table vs user. # temp_table sybase_iq

I wonder what the difference is between #temp_table and the 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

- close my client

 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

- close my client

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

My main question is why

 select * from sysobjects where name = '#temp_table'

returns nothing with the user.

  select * from sysobjects where name = '#temp_table'

returns information.

+4
source share
1 answer

When adding a username. # Sybase table_name automatically ignores #. What you create is a regular user table. In fact, if you check it with

 select * from sysobjects where name = '#temp_table'

the type must be "U", which means that you created a user table = not a temporary table at all.

Best regards, Enrique

+1
source

Source: https://habr.com/ru/post/1688684/


All Articles