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.
| Author |
Topic |
|
robinkurian
Starting Member
2 Posts |
Posted - 2012-03-08 : 16:29:13
|
| Hello Folks:Can I create a temporary table in SQL server which keep data for entire session (user logon to user logoff) and we can query from the triggers, procedures, functions to get the session specific data?ThanksRobin |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2012-03-08 : 16:39:49
|
quote: Can I create a temporary table in SQL server which keep data for entire session (user logon to user logoff)
Yes. As long as the connection that created the table isn't closed, the temp table will persist (unless you drop it of course).quote: and we can query from the triggers, procedures, functions to get the session specific data?
You'll have to provide more information on what exactly you're looking for. You can query session-related data using the SESSIONPROPERTY function, anything else you'll have to provide an example. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-03-08 : 17:37:13
|
quote: Originally posted by robinkurian Hello Folks:Can I create a temporary table in SQL server which keep data for entire session (user logon to user logoff) and we can query from the triggers, procedures, functions to get the session specific data?ThanksRobin
you mean access the temporary table from all other sessions through trigger,procedure,functions?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
robinkurian
Starting Member
2 Posts |
Posted - 2012-03-09 : 15:59:23
|
| Thanks for the reply.I will explain my requirement. In my application, I need to get the user name who is logged on to the system. But this user is only an application user ( not a database user; all users are connecting to DB using a common database userid). I have created a temp table (#tempuserid) through a procedure in the app logon event and try to get the value from the temp table in another event (for example: inside a trigger before inserting/updating data) in same session, but it failed. Please help.Thanks, Robin |
 |
|
|
|
|
|
|
|