-1

How do I set the transaction isolation level within in a table value multi function? I know it can be done in a stored procedure.

create function dbo.Test()
RETURNS @TestTable Table (test varchar(1000))
AS 
begin

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

I am receiving error below:

Msg 443, Level 16, State 15, Procedure abcde, Line 12
Invalid use of a side-effecting operator 'SET TRANSACTION ISOLATION LEVEL' within a function.
3

You can't set the transaction isolation level inside a function. You can use lock hints on the queries used in the functions instead.

Although you should really avoid using either READ UNCOMMITTED or the nolock lock hint.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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