Link to home
Start Free TrialLog in
Avatar of malraff
malraffFlag for Ireland

asked on

SQL update issue : ANSI padding?

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

Avatar of santoshmotwani
santoshmotwani
Flag of Australia image

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.


Avatar of malraff

ASKER

no, the fields i am updating are all user selectable options, eg yes or no  
ASKER CERTIFIED SOLUTION
Avatar of cyberkiwi
cyberkiwi
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of malraff

ASKER

you were right cyberkiwi;

a trigger on the table im updating is causing the issue

help much appreciated folks

mal