Board index » delphi » Check temporary table existence in SQL 7.0

Check temporary table existence in SQL 7.0

Hi all,
I am using a local temporary table (#new) in SQL7. How can I check if it
already exists so I can drop it before recreating it?
Thanks
 

Re:Check temporary table existence in SQL 7.0


Quote
Nikos Voudouris <nik...@yahoo.com> wrote in message news:3b372503_2@dnews...
> Hi all,
> I am using a local temporary table (#new) in SQL7. How can I check if it
> already exists so I can drop it before recreating it?

Try

    IF OBJECT_ID('TempDb..#TempTable') IS NOT NULL
    Drop table #TempTable

It should work.

GL

rb

Re:Check temporary table existence in SQL 7.0


You can also use a TTable component and use its TableExists method

Quote
Nikos Voudouris wrote:
> Hi all,
> I am using a local temporary table (#new) in SQL7. How can I check if it
> already exists so I can drop it before recreating it?
> Thanks

--
Guillermo Casta?o Acevedo <SIRIO>
Guiller...@GrupoMillennium.com
Guillermo...@Hotmail.com
WWW: http://www.GrupoMillennium.com (Gerente de Sistemas)
ICQ # 33844513
Systems and Computers Engineer

Re:Check temporary table existence in SQL 7.0


Check out the TempDB database where your temp table will be going,
Sysobjects table to be specific.
AFAICR, SQL7 will append some characters into your temp table name.... so
bear that in mind as well.

HTH,

Mio Nino P. Marquez

Other Threads