how to select a table with no locks

  • I am trying to select a table without locking it. How come the following produces a syntax error?

    USE NORTHWIND

    SELECT EmployeeID FROM Employees WHERE EMPLOYEEID = 4 WITH (NOLOCK)

    Server: Msg 156, Level 15, State 1, Line 1

    Incorrect syntax near the keyword 'WITH'.

    Thanks in advance,

    Billy

  • Try it after the table name.

    USE NORTHWIND

    SELECT EmployeeID

    FROM Employees WITH (NOLOCK)

    WHERE EMPLOYEEID = 4

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply