Xin Xin - 1 year ago 61
SQL Question

What is the view's isolation level when you set in store procedure level?

The title may be hard to read. scenario is like this:

I have a view: my_view (by default, it will be read committed)

Then I have just created a new SP, content is below:

select *
from table1
inner join my_view

Now, of course, table1 will be read uncommitted, but what about my_view?
Is it read committed or read uncommitted?


Answer Source

I have a view: my_view (read committed)

No, the view does not have an associated isolation level, as you seem to imply. The view is just a stored query. And that query will execute in whatever isolation level is in effect at the time you run it.

So if your view is queried from a stored procedure that sets the isolation level to read uncommitted (your example), then the query will be executed in that isolation level, simple as that.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download