March 28, 2011 at 2:33 pm
I am getting the error below when I run this query:
The multi-part identifier "a.PO_ITEM_CATEGORY" could not be bound.
UPDATE dbo.trialINVOICE
SET a.PO_ITEM_CATEGORY = b.[segment3]
FROM dbo.trialInvoice a
JOIN dbo.tempINVOICE b
ON a.PURCHASING_CATEGORY_ID = b.CATEGORY_ID
WHERE a.PO_ITEM_CATEGORY IS NULL
I am trying to set the PO Item Category column = to Segment3, and this is the only way I could figure out best to do it.
Another Question: Is there a way, if I have both of the columns in one table, that I could set the PO Item Category field = Segment3 when the PO Item Category field is Null?
March 28, 2011 at 3:25 pm
For your first question, you do not need to qualify the column you are updating. Try this:
UPDATE a
SET PO_ITEM_CATEGORY = b.[segment3]
FROM dbo.trialInvoice a
JOIN dbo.tempINVOICE b ON a.PURCHASING_CATEGORY_ID = b.CATEGORY_ID
WHERE a.PO_ITEM_CATEGORY IS NULL ;
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
March 28, 2011 at 3:27 pm
emilybrank (3/28/2011)
Another Question: Is there a way, if I have both of the columns in one table, that I could set the PO Item Category field = Segment3 when the PO Item Category field is Null?
If the columns are in the same table you do not need a JOIN:
UPDATE dbo.trialInvoice
SET PO_ITEM_CATEGORY = [segment3]
WHERE PO_ITEM_CATEGORY IS NULL ;
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply