Quantcast
Viewing all articles
Browse latest Browse all 3587

Re: @@procid but which dbid

Would need more details on how those procs (with the same name but different databases) end up firing the same trigger.

 

For example, if the login running a given proc is limited to running said proc from a specific database, then you could troll through all potential databases that have such a proc (see earlier sysdatabases/object_name() query) looking for the one where the current login (suser_name()) exists in sysusers (or sysalternates?).

 

If a login could run the proc from multiple databases (either as their own user, as an alias, or via the 'guest' user) then you're back to square one.

 

Similar 'logic' could probably be applied to the data available via the inserted/deleted tables (from within the trigger), eg, if the data is unique for a specific login, application or database then perhaps you could use this info to determine which db the proc was executed from.

 

-----

 

Probably easier to get access to monProcessProcedures.


Viewing all articles
Browse latest Browse all 3587

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>