| | |
Return database that a trigger was executed in
Please support our MS SQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
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!!
Views: 608 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for MS SQL
"last age autogrowth business connectingtodatabaseinuse count cursor data database dateadd datediff datepart day" dbsize deadlock delete_trigger exploit getdate hack highperformancecomputing hpc hpcserver2008 ibm iis limit live loop maximum microsoft ms mssql multiple multithreading news number password permission position query reporting result security server services sets single source sql sql-injection sqlserver sqlserver2005 subtype supercomputing supertype tables uniqueid update view weekday






