1

I've a query to run a SQL server table, in which, I am not concerned with the exact count. So, I want to specify NOLOCK for that query. But, query itself consists of multiple subqueries and multiple joins; so, it's quite dirty to put NOLOCK all around.

Although, I can set the transaction level "READ-UNCOMMITTED" for the tables, but that would change it for all other queries as well. I want to change the transaction level for that particular query, but without specifying NOLOCK in the query at multiple places. Is that possible?

ptntialunrlsd
  • 794
  • 8
  • 23
  • 2
    "but that would change it for all other queries as well" - transaction isolation level is defined at the session level, it doesn't affect other sessions - and you can change your isolation level before and after this particular query. So I'm not clear on what "other queries" you're concerned about this affecting. – Damien_The_Unbeliever Mar 30 '15 at 09:50
  • So, if I change before executing this statement. Will it not affect the other queries that are running on the same tables? Will they continue to run with the previous transaction level? – ptntialunrlsd Mar 30 '15 at 10:28
  • 2
    Yes, as I said, this is defined at the session level. Other sessions will use whatever isolation levels *they* have selected. – Damien_The_Unbeliever Mar 30 '15 at 10:34
  • So, what would it take to make the transaction level change at a global level for a particular table? – ptntialunrlsd Mar 30 '15 at 10:54
  • I'm pretty sure this can't be set globally for a particular table. – Tab Alleman Mar 30 '15 at 13:10

0 Answers0