Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 temporary table

Author  Topic 

avijit_mca
Posting Yak Master

109 Posts

Posted - 2008-10-29 : 02:32:06
i have 10 user.
for eg my table name table1.
when individual user open their font end application & refresh application then delete table1 data & reload data depending on user.

hope so in that case we have to use temporary table.
i know temporary table work for one session...
now my question is that ,

at time three user loging & refresh application...in that case what happen ?

i mean it will create three temporary table or what?

Regards,
Avijit

karthickbabu
Posting Yak Master

151 Posts

Posted - 2008-10-29 : 04:48:37

You mean, get data from the same table to temporary table for all user. To generate different temp table for every user. When creating Temp Table create random number and concatenate with that table name.

Like as below:

#TempTable


Before create this table create random number and add it

#TempTable + rndNumber - #TempTable345855

It will create a table for every user.


================================================

When you realize you've made a mistake, take immediate steps to correct it.
Go to Top of Page

avijit_mca
Posting Yak Master

109 Posts

Posted - 2008-10-29 : 05:23:32
Hi karthick,
in real business scenario we have to use same table name but different user can access that table & update value depending on their requirement.

eg. when user1 login that time table1 contain only value say val11 & val12.
when user2 login that time table1 contain only value say val21 & val22.
when user3 login that time table1 contain only value say val31 & val32.

so in that case what we will do?
Any idea?




Regards,
avijit
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-29 : 05:29:14
what deterimes which values should be available for a particular user?
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2008-10-29 : 07:06:08
Sounds like you might want a process keyed table

Something like

CREATE TABLE <theTable> (
[userId] INT -- This is the column for process Key -- each user gets his own integer number
, [<colA>] <WHATEVER>
, [<colB>] <WHATEVER>
...
...
)


Than in you application only let the user see his own process key info (when you delete delete only entries with the user's ID). This way it is totally transparent to the users and you get all the benefits of a permanent table.

Without you posting much more detail on your business reqs I'm not comfortable suggesting more than this.

-------------
Charlie
Go to Top of Page
   

- Advertisement -