3

I have the following query:

update Table1
set id=2
where nbr in (select nbr from Other.dbo.table)

The "select nbr from Other.dbo.table" has 500 records. Yet when I run the update, it says I am updating 1,000 records. I have checked table1, and there are only 500 rows that match the filter.

select * from table1 where nbr in (select nbr from Other.dbo.table)

I tried changing the query to be a join and using a temp table to store the filter list, but I receive the same results.

Why am I updating 1000 records when only 500 match?

There is an update trigger on Table1.

3

An update trigger on table1 causes the UI to return double the amount of records. The 500 records are being updated. However, each update causes a new record to be inserted into an audit table. The UI returns the count of the total rows affected for the query statement, not just the update itself!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.