MarKuz
MarKuz

Reputation: 53

#temp_table vs user.#temp_table sybase_iq

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

return nothing, and with user.

  select * from sysobjects where name = '#temp_table'

returns the info.

Upvotes: 3

Views: 151

Answers (1)

Enrique Benito Casado
Enrique Benito Casado

Reputation: 2080

When you add user_name.#Table_name Sybase ignore automatically the #. What are you creating is a normal user Table. In fact if you check it with

 select * from sysobjects where name = '#temp_table'

the type should be 'U' what means that you have created a user table = not temporary table at all.

Best Regards, Enrique

Upvotes: 1

Related Questions