Interface program has been running very stable, one day of the database rectification, resulting in the program constantly error,
The error message is as follows
Reason:
The program code writes the following code
SELECT * from ViewName with (Updlock) where XXX
And this view code for the database is as follows
SELECT * from TableName with (NOLOCK) where XX
As long as the execution of this query, will result in the above error, the above error code, a need to lock, one does not need to lock, so the error
So write the view of the database
SELECT * from TableName where XX with CHECK option
That's it, the exact reason is still under study.
With (NOLOCK)-Means no locking
updlock-represents an update lock, and after the query is executed, its value is locked until the transaction commits to be updated
With CHECK option-?
sqlserver-Analysis of error causes of Updlock and withnolock and with CHECK option at one time