if we are using the transaction no lock in stored procedure then it will also applicable in functions used inside the procedure or not ?
Loading
if we are using the transaction no lock in stored procedure then it will also applicable in functions used inside the procedure or not ?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Anandu G NathPosted Dec 20, 2023, 5:33 AM
In SQL Server, the behavior of transactions with respect to locking extends to functions called within a stored procedure, depending on how these functions are implemented and their transaction handling.
When a stored procedure is executed within a transaction context with the
NOLOCKhint (or other isolation levels likeREAD UNCOMMITTED), the behavior inside the stored procedure, including the functions it calls, will also adopt the specified isolation level.Nitin SontakkePosted Jan 6, 2023, 8:42 AM
The simplest answer is, you cannot.
Furthermore, the SQL Server community largely discourage this practice altogether.
Brahma Prakash ShuklaPosted Jan 6, 2023, 7:14 AM
So, How we use no lock in whole function used inside the stored procedure and stored procedure contains no lock ?
Note:- we don't need to use no lock in queries used in the function.
Nitin SontakkePosted Jan 5, 2023, 4:14 PM
It seems you mean to say HINT (no lock).
If that is what you mean, then the answer is no.