Locating global temp tables via asp problem

  • Hi,

    I've created a temp table to hold values for a report within an sp. ASP code then checks for the existance of the temp table to decide if a report report is to be printed or not.

     strSQL = "SELECT id FROM tempdb..sysobjects WHERE name = '##tmptable' AND Type = 'U'"

    After the sp has run, I can run the above via SQL query analyzer and have the id returned. If however I perform the same check from within my asp page, no values are returned. Any ideas?

    Thanks,

    Neil

  • If you are using Query Analyzer to run the tests this will probably work because QA keeps the connection open and it will continue to see the temporary table.

    As far as I know, the temp tables for a session are cleaned as soon as the connection is broken. 

    Given the disconnected nature of ASP pages, I think you need to rethink your design.

     

  • Well, table with two hashes (##tmptable) is global and should be visible to other users as well - as long as the connection in which it was created is active. On breaking this connection, table is deleted, if no other connection works with it at that time. Isn't this the source of your problem?

    Since I don't know much about asp, I'm not sure how the connections are being established and broken, and what it means for global temporary tables. I'm sure someone will come with the right explanation soon!

    cheers

    Vladan

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply