Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
azamsharp
Posting Yak Master
201 Posts |
Posted - 2006-01-02 : 23:10:26
|
| Can I make a trigger which is fired when a row is inserted or deleted from any table in a particular database? Thanks, AzamMohammad Azam www.azamsharp.net |
|
|
shallu1_gupta
Constraint Violating Yak Guru
394 Posts |
Posted - 2006-01-02 : 23:18:42
|
| trigger are table specific. while creating a trigger you need to specify the table name on which you want to create that trigger. but what exactly is ur requirement? |
 |
|
|
azamsharp
Posting Yak Master
201 Posts |
Posted - 2006-01-02 : 23:54:10
|
| Thanks for the reply. I like to do the following: When you insert a records in a table of a particular database. It should make an entry in another table specifying which table entry is made and at what time.Mohammad Azam www.azamsharp.net |
 |
|
|
mav13
Starting Member
4 Posts |
Posted - 2006-01-03 : 00:03:49
|
| you could write an insert trigger with the code stating to do the required insert into the other table. Say if you are inserting records into table A and you want the other entries to be made in table B you could use something likeCreate Trigger TrigNameOn AFor InsertAsInsert B Values(...)Your stated requirement should be met using something like this.Prashant |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2006-01-03 : 08:53:35
|
We do this sort of thing by writing some code that generates the code for the Triggers - so we get codes for gazzillions of triggers, one fro each of the gazzillions of tables in our database , and just execute that.Kristen |
 |
|
|
azamsharp
Posting Yak Master
201 Posts |
Posted - 2006-01-04 : 11:27:50
|
| Thanks Kristen. Thats a sweet idea :)Mohammad Azam www.azamsharp.net |
 |
|
|
|
|
|