Solved

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

Posted on 2006-11-10
7
962 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
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 200 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 69

Accepted Solution

by:
ScottPletcher earned 300 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:ScottPletcher
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how the fundamental information of how to create a table.

919 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now