d***@gmail.com
2013-05-22 14:24:52 UTC
Hi!
We have more frequently used constants in another database.
For example: "Current_User" which represent the current logged user id.
We used it in my triggers, queries, etc.
I plan to port this in MS SQL server, and I want merge all users to logical level (to roles), for not use database level (real ms users).
But I'm not sure what MS SQL server supports.
I have two ways:
1.)
I created a named temporary table (dropped at session's end), put the needed constants to it, and later I used "select into" or "join" to get this info.
For example the current_userid = 128.
This can be used in trigger, stored proces, and queries too.
2.)
If the MS-SQL supports to define session level variables, I would use them instead of temp table. But I want to access/use them in triggers, stps, and queries too.
Please help me: does SQL server support these session level variables, or other way; or I need to use temp table to store my session level constants anywhere?
Thanks for any help!
Regards: dd
We have more frequently used constants in another database.
For example: "Current_User" which represent the current logged user id.
We used it in my triggers, queries, etc.
I plan to port this in MS SQL server, and I want merge all users to logical level (to roles), for not use database level (real ms users).
But I'm not sure what MS SQL server supports.
I have two ways:
1.)
I created a named temporary table (dropped at session's end), put the needed constants to it, and later I used "select into" or "join" to get this info.
For example the current_userid = 128.
This can be used in trigger, stored proces, and queries too.
2.)
If the MS-SQL supports to define session level variables, I would use them instead of temp table. But I want to access/use them in triggers, stps, and queries too.
Please help me: does SQL server support these session level variables, or other way; or I need to use temp table to store my session level constants anywhere?
Thanks for any help!
Regards: dd