By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,339 Members | 1,680 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,339 IT Pros & Developers. It's quick & easy.

Trigger ISSUE

P: 10
I have a problem that i cant seem to find out why i am getting this error when updating table I am get error saying cant in NULL in field name CreateByUser.
I am using a INSTEAD OF INSERT Trigger. This trigger is triggered from a store procedure with the information is transfer via a XML file. The insert of a new record is done without any problem. Can someone help Below is the update code

BEGIN
UPDATE Customer
SET CustomerCode=@CustomerCode,CustomerIdentificationT ype=@CustomerIdentificationType ,
CustomerIdentificationGroupCode=@CustomerIdentific ationGroupCode,DocumentNumber=@DocumentNumber,
FirstName=@FirstName,LastName=@LastName,MiddleName =@MiddleName,
CustomerName=@CustomerName,ContactPerson=@ContactP erson,ContactTitle=@ContactTitle,
Country=@Country,ParishOrState=@ParishOrState,Dist rictOrCity=@DistrictOrCity,CommunityOrTownShip=@Co mmunityOrTownShip,
Street=@Street,TelephoneNumbers=@TelephoneNumbers, CellPhoneNumbers=@CellPhoneNumbers,
EmailAddress=@EmailAddress,Photo=@Photo,CustomerCa tegory=@CustomerCategory,
CustomerIdentificationIssuingInstitution=@Customer IdentificationIssuingInstitution,
CustomerIdentificationIssuingCountry=@CustomerIden tificationIssuingCountry,CustomerIdentificationExp irationDate=@CustomerIdentificationExpirationDate,
CustomerIdentificationCategory=@CustomerIdentifica tionCategory,Comments=@Comments,Occupation=@Occupa tion,DateofBirth=@DateofBirth,
TaxRegistrationNumber=@TaxRegistrationNumber,LastT radeDate=@LastTradeDate,LastTradeValue=@LastTradeV alue,
LastTradeType=@LastTradeType,TraderAssignedToAccou nt=@TraderAssignedToAccount,DiscountPuchaseTrade=@ DiscountPuchaseTrade,
DiscountSaleTrade=@DiscountSaleTrade,MinimumPuchas eTradeValueForDiscount=@MinimumPuchaseTradeValueFo rDiscount,
MinimumSaleTradeValueForDiscount=@MinimumSaleTrade ValueForDiscount,Active=@Active,CompanyCode=@Compa nyCode,LocationCode=@LocationCode,
BranchCode=@BranchCode,OwnerCode=@OwnerCode,DateTi meCreated=@DateTimeCreated,DateTimeModified=@DateT imeModified,
CreatedByUser=@CreatedByUser,ModifiedByUser=@Modif iedByUser,SourceOfFunds=@SourceOfFunds
WHERE CustomerCode = @CustNum
END
IF @@ROWCOUNT <> 0
BEGIN
INSERT INTO
SysDatabase_Transactions( Record_Id,TableName,Operation,TransferDateTime)
SELECT b.CustomerCode,'Customer','U',Getdate()
FROM Inserted b
END
Feb 27 '08 #1
Share this Question
Share on Google+
1 Reply


ck9663
Expert 2.5K+
P: 2,878
I think that means CreateByUser does not accept NULL value. That could happen on your INSERT. Since, the UPDATE is manipulating an existing row and CreateByUser is not on your UPDATE sql. I can only assume that would be on your INSERT. In it you specified certain columns and CreateByUser is not on it. Maybe you need to include it.

Happy Coding

-- CK
Feb 27 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.