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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Compare

Author  Topic 

paperclip
Starting Member

3 Posts

Posted - 2007-11-26 : 13:28:52
I have an application that writes records with a timestamp to an sql table.

I wish to compare the values in each field and see if they have changed from the previous record and then delete if they haven't. Can anyone offer a script or procedure to do this please?

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-11-26 : 14:01:16
quote:
Originally posted by paperclip

I have an application that writes records with a timestamp to an sql table.

I wish to compare the values in each field and see if they have changed from the previous record and then delete if they haven't. Can anyone offer a script or procedure to do this please?



Since you didn't post the table DDL, it is very hard for us to offer any specific help.

I would suggest that you do it this way:
Compare the data you want to write to the prior row, and do not insert it if there is no change, instead of inserting a new row and deleting it if there was no change.



CODO ERGO SUM
Go to Top of Page

paperclip
Starting Member

3 Posts

Posted - 2007-11-27 : 05:48:41
Being completely new to this can you tell me what the DDL is please
Go to Top of Page
   

- Advertisement -