We help IT Professionals succeed at work.

SQL update issue : ANSI padding?

malraff
malraff asked
on
hi all

i have imported data from excel to sql, from this data i am looking to do an update on SQL data by using the below code,

it is returning with the below error, there isnt even such thing as dbo.products! from initial searches it refers to a padding issue? can anyone advise?
 
Msg 2627, Level 14, State 1, Procedure InvMasterIU, Line 38
Violation of UNIQUE KEY constraint 'UQ__Products__014935CB'. Cannot insert duplicate key in object 'dbo.Products'.
The statement has been terminated.
use SysproCompanyT

update InvMaster
SET Ebq = mps.EBQ, BuyingRule = mps.BatchingRule, MpsFlag = mps.MPSItem, GrossReqRule = mps.GrossReq
From InvMaster as i JOIN mal.dbo.MPSData mps 
ON mps.StockCode = i.StockCode

Open in new window

Comment
Watch Question

Top Expert 2010

Commented:
Iam wondering if you have fields in the table set to Unique ??

If yes

Set  to allow Null for tht field.
 If so this will cause this error, as its Unique you can only have one record where this field is set to Null.


Author

Commented:
no, the fields i am updating are all user selectable options, eg yes or no  
Expert of the Quarter 2010
Expert of the Year 2010
Commented:
The error is further down in the procedure InvMasterIU
In fact, line 38 as it says.

Search for "Products" in there or a call to another proc that tries to insert into the table "Products".
It is also possible that there is a trigger on a table referenced in the SP that tries to insert into Products.

Author

Commented:
you were right cyberkiwi;

a trigger on the table im updating is causing the issue

help much appreciated folks

mal