If I read this question, I would immediately think that "someone is an idiot asking for help before doing any research." It is still unclear if the βidiotβ is correctly marked, I can assure you that this is not my first rodeo, and I hit my head against the wall for 40-80 hours.
A brief history: My system executes 1 update statement four times, passing four different parameter values. Based on constraints, each run should change approximately 50,000 lines. However, while 2 of the executions change the expected number of rows, the other two only update 201 rows.
Disclaimer:
Trying to convince you, I'm not a noob who updates one database, and then wonders why the records in the other database are not updated.
- I am a programmer with experience of over 15 years, specializing in systems in which batch processing performance is critical.
- My level of knowledge with SQL Server is lower than a typical DBA, but significantly higher than a regular developer
- As I mentioned above, I spent 40-80 hours researching this problem.
- I have no ideas
Long story:
The corresponding table looks something like this:
- MyPkCol - BIGINT - is not involved in the UPDATE statement. Only a column in a clustered index
- MyForeignKeyCol1 - BIGINT - a pointer to another table that is cleared by Update
- MyIntCol - INT - The underlying data that is cleared by Update.
- MyForeignKeyCol2 - BIGINT - , Update
, MyForeignKeyCol1 ( ).
, MyForeignKeyCol2 ( ).
MyForeignKeyCol1, - MyForeignKeyCol2.
:
UPDATE T1
SET MyForeignKeyCol1 = NULL,
MyForeignKeyCol2 = NULL,
MyIntCol = NULL
WHERE MyForeignKeyCol2 = ?
. 200-300 , 3 .
200 000 . 50 000 123 MyForeignKeyCol2, 50 000 345 MyForeignKeyCol2, 50 000 567 MyForeignKeyCol2, 50 000 789 MyForeignKeyCol2.
4 , 123, 345, 567 789. 4 . , :
, 49799 MyForeignKeyCol2=345, 49799 MyForeignKeyCol2=567.
.
, UPDATE MyForeignKeyCol2 , 345 567, , UPDATE - . 99,99% , .
- ?
, DB , , , , , , , .
!