| | |
Return database that a trigger was executed in
Please support our MS SQL advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Apr 2008
Posts: 58
Reputation:
Solved Threads: 9
I would like to create a variable in my trigger - @DBNAME.
When the trigger executes, this value should be set to the name of the database it was executed in.
E.g. for the master database the value of @DBNAME would be master.
How would I go about figuring out which database this was executed in? (This same trigger would be in place across multiple databases).
Thanks!
When the trigger executes, this value should be set to the name of the database it was executed in.
E.g. for the master database the value of @DBNAME would be master.
How would I go about figuring out which database this was executed in? (This same trigger would be in place across multiple databases).
Thanks!
•
•
Join Date: Aug 2008
Posts: 1,162
Reputation:
Solved Threads: 138
MS SQL Syntax (Toggle Plain Text)
SELECT db_name()
Custom Application & Software Development
www.houseshark.net
www.houseshark.net
![]() |
Similar Threads
Other Threads in the MS SQL Forum
- Previous Thread: Database and Domain are of different web hosting
- Next Thread: URGENT!! Need help regarding primary key!!
| Thread Tools | Search this Thread |
Tag cloud for MS SQL
"last autogrowth business connectingtodatabaseinuse count cursor data database dateadd datepart day" dbsize deadlock delete_trigger getdate highperformancecomputing hpc hpcserver2008 ibm iis limit loop maximum microsoft ms mssql multiple multithreading news number permission position query reporting result server services sets single source sql sqlserver sqlserver2005 subtype supercomputing supertype tables uniqueid update view weekday






