Results 1 to 2 of 2

Thread: Global temp tables

  1. #1
    Nisha Guest

    Global temp tables

    Hi everyone:

    I am creating an sp, in which I check for the existence of a global temp table (using the exists)
    statement. If the Exists returns a false, I move on to processing without the temp table. If it
    returns a true, I utilize the temp table to do some inserts. I create the temp table when my
    application first starts up. The problem that I am facing is that the check for the temp table`s
    existence seems to be failing. Is there any other way to check for the existence of a global
    temp table??

    Any info really appreciated
    Thanks
    Nisha


  2. #2
    Don Romano Guest

    Global temp tables (reply)

    Is a process still using the ##temptable when you run the existance check?

    From Books OnLine:

    "SQL Server supports two types of temporary tables: local and global. A local temporary table is visible only to the connection that created it. A global temporary table is available to all connections. Local temporary tables are automatically dropped at the end of the current session. Global temporary tables are dropped at the end of the last session using the table (normally, this is when the session that created the table ends)."

    Also... where are you checking for ##temptable? If you do a

    select * from tempdb..sysobjects

    you should see it if it exists.

    Don

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •