temp table for single user but many connections

  • Do i have some possibility to create a temp table that :

    1. Can be used in many connetions of this user. In first window of application i'm created a table and in second window i wont to see it.

    2. Visible for one user only. The user that created it.

    # temp table i can't use in many connections. In the second window the SQL do not know that table.

    ## temp table see all users. In the second window i see all data in the table. Not only my data.

    Using the user number or something like this is not so good.

    May be sql 2008 have more possibilitys?

  • Temp tables are either per-connection or global. There's no concept of a per-user temp table.

    What you can do is give each user their own schema, set that as their default schema and create a permanent table in that schema. That way, each user will see their own permanent table.

    If user Mary queries Table1 she gets Mary.Table1, while if user Jeff queries Table1 he gets Jeff.Table1

    Be careful if you go that route. If you allow the table to be created and dropped, you need to give out sufficient permissions, which may not be such a good thing for security.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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