Reputation: 13844
I have the query
select * from products p, products_temp t
where p.ManufacturerPartNumber = t.[INV-PRICE-VENDOR-PART]
where the column names have dashes in them which SQL Server 2005 seems to automatically add brackets to. What is the correct way of accessing this in a query? I've tried with brackets and without the brackets and just end up with errors.
the error I get from sql mgmt studio is
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'where'.
thanks in advance
Upvotes: 0
Views: 3792
Reputation: 103587
use "current" join syntax:
SELECT
*
from products p
INNER JOIN products_temp t ON p.ManufacturerPartNumber = t.[INV-PRICE-VENDOR-PART]
Upvotes: 0
Reputation: 13420
that is because you have repeated WHERE twice in your statement. Got nothing to do with the square brackets which you will need because of the dashes.
Upvotes: 3