| | |
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: 137
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 |
autogrowth connectingtodatabaseinuse count cursor data database datepart dbsize deadlock delete_trigger highperformancecomputing hpc hpcserver2008 ibm iis loop maximum microsoft ms mssql multithreading news number permission query reporting result server services sets source sql sqlserver sqlserver2005 supercomputing uniqueid update view






