Tech Talk A software developer on all things tech, and then some

25Aug/120

Cannot find either column “[ColumnName]” or the user-defined function or aggregate “[ColumnName]”, or the name is ambiguous

I had the following, really simple, issue when adding no locks to my join statements. (I'm relatively new to nolocks since my other applications didn't require almost immediate concurrent access)

Note: Tables names were changed obviously

(((dbo.TableA a (NOLOCK)
JOIN dbo.TableB b ON a.index = b.index(NOLOCK))
JOIN dbo.TableC c ON a.index = c.index(NOLOCK))

And it was throwing

Msg 4121, Level 16, State 1, Line 3
Cannot find either column "b" or the user-defined function or aggregate "b.index", or the name is ambiguous.

Fix : add the nolocks after the naming, before the on... ex:

(((dbo.TableA a (NOLOCK)
JOIN dbo.TableB b (NOLOCK) ON a.index = b.index)
JOIN dbo.TableC c (NOLOCK) ON a.index = c.index)

The fix was as simple as the issue. Hope this helps anybody new to using nolocks as well!

Comments (0) Trackbacks (0)

No comments yet.


Leave a Reply

No trackbacks yet.

%d bloggers like this: