?
Solved

Can you set SQL Query Analyzer to automatically use NOLOCK on Queries?

Posted on 2006-11-10
7
Medium Priority
?
984 Views
Last Modified: 2008-02-01
Experts:

I'm a Crystal Reports expert. We've been instructed that when we use MS SQL Query Analyzer we must input the NOLOCK command with our queries. However that we do NOT need to worry about doing this with Crystal Report as they (DBA) tells me that Crystal Automatically does this.????(I'm checking with the Crystal Experts on this...)

I do not believe that Crystal Reports is using NOLOCK....as I can't see it in the SQL Query that is generated.

Anyway,...I'm just curious....is there a way to setup Query Analyzer to automatically consider my queries....AS .....NOLOCK.....??


Thanks


MikeV
0
Comment
Question by:MIKE
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 11

Expert Comment

by:Otana
ID: 17914141
As far as I know, this is not possible.
0
 
LVL 11

Assisted Solution

by:rw3admin
rw3admin earned 800 total points
ID: 17916747
No Crystal doesnt do that, Using NoLOCK is your SQL directive (hint) to Not use ANY existing locks on tables you cannot automatically set your queries to NOLOCK

I would advise highly against NOLOCK use, specially for reporting cause NOLOCK WILL read dirty records as it can read a table thats in transaction, may it be due to update insert or delete,
so imagine you are doing a mass update of price for items (increasing prices by 5%) and you use NOLOCKS and print this report they WILL see huge difference in TOTAL per their expectations, I can give you ten other examples like this.

NOLOCK should be used as monitoring any updates/deletes/inserts not for reporting...

0
 
LVL 17

Author Comment

by:MIKE
ID: 17916928
We have separate servers for each process:  Development, Quality Assurance, Production.

Data on all of our servers are updated/refreshed every 15 mins.

Thanks for the added insight....it is much appreciated.

MikeV
0
Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

 
LVL 69

Accepted Solution

by:
Scott Pletcher earned 1200 total points
ID: 17917097
You can specify "READ UNCOMMITTED" as a *connection* setting and it will apply to *all* tables on *all* queries run thru that connection (it's equivalent to specifying "(NOLOCK)" on every table in every SELECT).
0
 
LVL 17

Author Comment

by:MIKE
ID: 17917136
Ahhhhh awesome.... yes..this is what I'm thinking about...


Thanks
MikeV
0
 
LVL 17

Author Comment

by:MIKE
ID: 17917142
Oh wait...but this would only be for users that would NEVER require...writing to database....correct?
0
 
LVL 69

Expert Comment

by:Scott Pletcher
ID: 17917203
It would apply per connection.  If the same connection were used for Crystal and, say, an app, the potential of "dirty reads" would apply to both.  Usually I've found that Crystal uses its own connection, typically via ODBC.

At any rate, it doesn't prevent writing, since writing will *always* lock.  You cannot turn off locking for inserts/updates/deletes; even if you specify it, SQL ignores it.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question