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 |
|
btscotland
Starting Member
2 Posts |
Posted - 2008-07-06 : 16:25:05
|
| Hi thereAlthough I have been playing with SQL server for a number of years I have recently had the ability to actually get onto a server rather than using the annoying web tools and I was wondering if triggers were an easy solution to a problem I am working on.I have 3 tables, Users Table, Users_Notes, Users_Sales. The master table is the Users table and in this there is a primary key which is an autonumber and used as the users userid.When a note or a sale is added to the database then the PK from the Users table is added to either Notes or Sales with corresponding information about what ever it is.I would like however to be able to see the last time that the User has had details updated. Rather than having to look at all 3 tables to find this information out I was thinking that if any of the notes or Sales was updated a field in Users called LastUpdated could be updated with the current date.Is this something that a trigger would do. Basically, whenever either Notes or Sales are updated it updates a date in the Users table automatically.Hope this makes sense? |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-07-06 : 21:14:19
|
you may use trigger to do this or if you are updating the tables via stored procedures just update the Lastpdated column in the stored procedure KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|