By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,401 Members | 1,381 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,401 IT Pros & Developers. It's quick & easy.

DML Trigger on Database not on table

P: 3
If i make any changes(Insert/Delete/Update)in a site then the corresponding changes will store in tables of that particular DB.
How to know on which table which operation(DDl/DMl)has done.
I would like to store DML activities on Database level in a table,not on perticular Table, Please help
Mar 12 '15 #1
Share this Question
Share on Google+
5 Replies


ck9663
Expert 2.5K+
P: 2,878
Depending on the version of SQL Server you are using, you may want to look at DDL trigger.

Good luck


~~ CK
Mar 12 '15 #2

P: 3
Yes I got the DDL trigger for whole Database but I am not getting the DML trigger for Database, DML triggers are only applicable for Tables, How can I do that to solve my problem.
Mar 13 '15 #3

ck9663
Expert 2.5K+
P: 2,878
I'm not sure what you are asking. Data Modification Language (DML) are done in a table. If you want to know which table was updated, you might need to set that up every table. Or checkout Change Data Capture and find out which got updated.

Good Luck!!!

~~ CK
Mar 13 '15 #4

P: 3
for DML we need to write trigger for each table but for my DB there are more number of tables so it is complicated to create each trigger for each table.
I think CDC can be applicable only on user database not on system database.so can you elaborate the working procedure of CDC.
Mar 14 '15 #5

ck9663
Expert 2.5K+
P: 2,878
System tables should not be modified like that. You should handle that on user-rights setting. For Data Modification Languages, your only option is trigger or CDC (check BOL). For DDL Languages, you can use database triggers.

Good Luck!!!


~~ CK
Mar 16 '15 #6

Post your reply

Sign in to post your reply or Sign up for a free account.