Yesterday found in the program data analysis results are not, after the analysis, the original data is still, the value of the field is cumulative. Heart said, not Ah, is to regenerate records before the analysis of AH. Did you forget to delete it? Check the code, found that there are DELETE statements. Then execute in Query Analyzer, error. Try again and again, understand, Delete from does not recognize table name alias! Thinking back, the original program after the main test in Oracle, SQL Server has not been carefully measured.
The reason to use aliases is because the where conditions need to use a subquery to write some conditions, the following is not written so complex, only to explain the problem.
Conclusion:
(Oracle applies) DELETE from TABLEA A WHERE a.field1=10
(SQL Server applies) DELETE TABLEA from TABLEA A WHERE a.field1=10
DELETE from TABLEA WHERE TABLEA (Ora\sql applies). field1=10
Two points experience:
1, testing to be comprehensive;
2, to be confident, write procedures to consider the situation is quite complete.
Update situation
Update T_report A
Set a.status= ' 1 '
where a.report_seq=1234
Execution failed
Update a
Set a.status= ' 1 '
From T_report A
where a.report_seq=1234
Successful execution
So to do a common program, do not use aliases