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 |
|
dearnr
Starting Member
2 Posts |
Posted - 2012-01-03 : 06:39:57
|
| Hi,Firstly many thanks for taking the time to look at my first post.I have an application that writes reports to SQL tables every 10 mins. The issue I have is that I only want the most recent results to be displayed and not the older ones. I would have prefered the application to do updates rather than inserts but this is third party software and is not possible.I thought about doing something that looked for when an update happened on a tabel to trigger a delete, is this possible and does anyone know what this would be called, i.e wather, function, event etc?Many thanks again |
|
|
whatamouth
Starting Member
16 Posts |
Posted - 2012-01-03 : 06:49:25
|
Yes that's possible. In SQL it's called trigger Neil Matiasneilmatias@yahoo.com |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2012-01-03 : 14:48:12
|
quote: Originally posted by dearnrI have an application that writes reports to SQL tables every 10 mins.
"STOP RIGHT THERE.....I GOTTA KNOW RIGHT NOW........" -MeatloafOK...ANOTHER 3rd party piece of garbage....What kicks off the "Writes"?What happens if the process is running every minute?Is it written to a permanent table or a temp table?Or many tables?you need to explain what's going on a little more in depth, BECAUSE if you can't change anything, what are you asking?Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxWant to help yourself?http://msdn.microsoft.com/en-us/library/ms130214.aspxhttp://weblogs.sqlteam.com/brettk/http://brettkaiser.blogspot.com/ |
 |
|
|
dearnr
Starting Member
2 Posts |
Posted - 2012-01-04 : 03:07:19
|
| whatamouth - thanks I think thats what I need!Okay sorry little more detail but think the trigger sounds good.We have this application that looks at the file system and tracks the size of users home folders and the type of files in there. This runs at a defined interval, in our case every 10 mins. The app just writes this information to a SQL db, in our case SQL 2008. The application is locked down meaning I am unable to make any changes but the DB is completely open so I could do work on here.All data is written to 1 table and I only want to keep the most recent records.I did a simple trigger to delete all the data but wanted to run this before insert, after looking through here I see that is not possible so I switched to a "INSTEAD OF INSERT" but having a few problems as the app seems to write lines indivdually and I presumed it would do this on bulk so I only get one line returned where i would expect a few hundred. i will get it sorted and post back in case it assists anyone else |
 |
|
|
|
|
|