I'm having issues resolving the ambiguity of column names with a table variable. A short example:
It gives me the error
Is there some other syntax for this?
Code:
declare @Inventory table(
ProductID int,
Quantity int
)
UPDATE @Inventory SET ProductID = NewProductID FROM tblNewProducts
WHERE tblNewProducts.ProductID = @Inventory.ProductID
If I comment out the WHERE clause, it parses fine. Dropping the table variable prefix bring the expects ambiguous column error.Must declare the variable '@Inventory'.
Is there some other syntax for this?