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 |
|
Ironwil
Starting Member
8 Posts |
Posted - 2009-08-30 : 00:28:21
|
| I'm setting up a blog database, and I have a comment count in a column in the blog item table. I want that value to be incremented each time a comment is made, and decremented each time a comment is deleted. I'd like to set this up as a trigger, but I don't know how. I've got the stub trigger set up:CREATE TRIGGER [NewTrigger] ON [dbo.[BlogComment] AFTER INSERT, DELETE ASGOBut what to put inside this, that is the question. Basically I was to grab the value of the CommentCount colmn from the BlogItem table, add/delete 1 to/from it, and set that value. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|