Showing posts with label table1. Show all posts
Showing posts with label table1. Show all posts

Thursday, March 22, 2012

Detecting whether table contents have changed

If I start with table1 and take a copy of it, call it table2.
How can I later determine whether there have been any changes have been made to table2 since the copy (so I can determine whether I need to copy back the changes to table1).

I'd like to use a 'last-updated-date' on the table, but I can't seem to find anything like that in the system tables.

I'm considering using:
exec sp_table_validation
to get checksums of table1 and table2 (I have no image, text or ntext fields) so this should work fine, though might be slow (since I'd have to select the full count(*) option).
I'd prefer to use timestamps if they're available.

And no, I don't want to use triggers.

Thanks,

- Andy AbelOther than using to trigger to *log* changes, you would have to do a full table *scan* to find the differences. This sure would take a long time to step through a large table.

Monday, March 19, 2012

details about finetuning queries

table1: In timings history
EMPID pk INTIME EFFECTIVE_DATE END_DATE
ENTERED_BY
tabl2 intiming
EMPID pk INTIME EFFECTIVE_DATE END_DATE enteredby
ta3
emptimings
ENTRYTIME pk EMPID TIMETYPE INOUT IP_ADDRESS
i want to calculate emp salary after deducting leaves and break timings
and other cuttingsddl means
CREATE TABLE TABLENAME ETC
SAMPLE DATA MEANS : insert into
--
Regards
R.D
--Knowledge gets doubled when shared
"raghu veer" wrote:

> table1: In timings history
> EMPID pk INTIME EFFECTIVE_DATE END_DATE
> ENTERED_BY
> tabl2 intiming
> EMPID pk INTIME EFFECTIVE_DATE END_DATE enteredby
> ta3
> emptimings
> ENTRYTIME pk EMPID TIMETYPE INOUT IP_ADDRESS
>
> i want to calculate emp salary after deducting leaves and break timings
> and other cuttings
>
>