tempdb

  • I come from IBM AS/400 background where there is a concept of temp libraries. Each user that logged in is assigned a unique temp library called QTEMP (directory in PC terms) which would be destroyed automatically when he signed off. So User A's QTEMP would be different than User B's QTEMP and so on. The developer did not have to do any additional programming to take care of that. He would only copy temp tables, user information, etc. to this library (basically the things he or she knew were not required to be saved after the user signed off).

    What is the recommendation to do the same in ASP.NET with SS as your database?

  • You can use #TempTables (Created the same way as you create a normal table, but with a hash (#) symbol before the name). The temptable is then visible only to that session. It lives temporarily in the temp db till they log out.

    Use a double-hash (##) to signify a global temporary table, visible to all current sessions.

    CREATE TABLE in books online has more about it under the Temporary Tables section.

     


    Julian Kuiters
    juliankuiters.id.au

  • SS has user specific temp tables as well....or rather 'connection specific temp tables' (which allows a user with multiple connections to have multiple same named temp tables)..

    look up info on tables with a prefix of # and ## (the latter are persistant temp tables...which means they last longer than the current scope...typically used across stored procedures...where "spA" fills the the temp table and "spB' read the same table...)

    further info available in BOL or by searching here.

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

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