3

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.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
MarKuz
  • 53
  • 8

1 Answers1

1

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

Enrique Benito Casado
  • 1,914
  • 1
  • 20
  • 40