Skip to Content
0

Command No Lock statement

Feb 07, 2017 at 03:17 PM

30

avatar image
Former Member

Hi

I have a Command running in a report that is taking a long time to run. I realise there could be a number of reasons for this (including poor Command writing skills!) but I have seen the statement of No Locks used somewhere before in a Command but cannot remember the syntax - any pointers please as I think this may help in this instance?

Thanks in advance for your help

Jon

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Ian Waterman Feb 07, 2017 at 04:55 PM
0

Only used in SQL server, syntax is

SELECT * FROM Tablename WITH (NOLOCK) WHERE field condition

use with care as not really appropriate for high volume transaction scenarios

http://stackoverflow.com/questions/686724/sql-server-when-should-you-use-with-nolock

Ian

Share
10 |10000 characters needed characters left characters exceeded
Abhilash Kumar
Feb 07, 2017 at 03:47 PM
0

Hi Jon,

What Database are reporting off of?

Also, how long does that SQL take to run directly against the database via a database client tool?

-Abhilash

Share
10 |10000 characters needed characters left characters exceeded
Don Williams
Feb 07, 2017 at 05:38 PM
0

If you are having performance issues I suggest using a Stored Procedure, that way the Server is doing all of the work and sending just the results to CR for formatting. And it's safer also.

Don

Share
10 |10000 characters needed characters left characters exceeded