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 |
djsemite
Starting Member
1 Post |
Posted - 2011-01-20 : 05:30:32
|
Question: When a new row is added to the Employee table, the iCurrentstrength (column) attribute of the Position table should be increased by one. Now guys i need the syntax to create the INSERT trigger.OR any clue to go by it.U guys are doing a great job here. |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-01-20 : 05:37:55
|
create trigger tr_Employee on Employee for insertasupdate Position set iCurrentstrength = iCurrentstrength + (select count(*) from inserted)goDoubt if that is exactly what you want but it will give you an idea.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2011-01-20 : 05:39:16
|
|
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-01-20 : 10:21:26
|
Why do you need a trigger for this? Why dont you use a select statement to return the count? Do you want to populate a serial no?MadhivananFailing to plan is Planning to fail |
|
|
|
|
|