Take the 2-minute tour ×

There is a view column named primary. How can I use this reserved word in a join?

My join:

inner join ACCOUNTS
on VIEWX.primary = ACCOUNTS.n_primary

I have tried aliasing the column in a select like this:


but that didn't work. The inner join still throws an error.

share|improve this question
Surround it with square brackets: inner join ACCOUNTS on VIEWX.[primary] = ACCOUNTS.n_primary –  Lieven Keersmaekers Nov 22 '13 at 12:32
add comment

1 Answer

SQL Server uses brackets to escape reserved words

inner join ACCOUNTS on VIEWX.[primary] = ACCOUNTS.n_primary
share|improve this answer
add comment

Your Answer


