Jul 5, 2013

Cannot execute query. There is more than one TABLE HINT clause specified for object ''. Use at most one such TABLE HINT clause per table reference.


If we will execute following sql query in sql server:

SELECT *
FROM Employee
WITH(FASTFIRSTROW,NOLOCK)
OPTION(TABLE HINT(Employee,FASTFIRSTROW),TABLE HINT(Employee,NOLOCK))

We will get error message like:

Cannot execute query. There is more than one TABLE HINT clause specified for object ''. Use at most one such TABLE HINT clause per table reference.

Cause: We cannot use more than one table hints in OPTION clause. It is syntax error.

Solution:

Correct syntax is:

SELECT *
FROM Employee
WITH(FASTFIRSTROW,NOLOCK)
OPTION(TABLE HINT(Employee,FASTFIRSTROW,NOLOCK))

No comments:

Post a Comment