Hi all,
While was working on a CTE select query recently which I use for paging of records for the web application, I got the following error message.
"Parameters supplied for object" which is not a function. If the parameters are intended as a table hint, a WITH keyword is required.
Guess, what is causing for this error message in the CTE (Common Table Expression) select statement?
Of course, (NoLock) that I use for the CTE table name.
In order to re-create the same error, I'm copying down a sample CTE select query.
WITH CTE (UserId, Code, Email)
AS
(
SELECT UserId, Code, Email FROM Users (NoLock)
)
SELECT GroupUsers.GroupId, CTE.UserId, CTE.Code, CTE.Email
FROM CTE --(NoLock)
INNER JOIN GroupUsers (NoLock) On GroupUsers.UserId = CTE.UserId
You see, I comment out the (NoLock) table hint after the CTE table name