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=@C ustomerCode,Cus tomerIdentifica tionT ype=@CustomerId entificationTyp e ,
CustomerIdentif icationGroupCod e=@CustomerIden tific ationGroupCode, DocumentNumber= @DocumentNumber ,
FirstName=@Firs tName,LastName= @LastName,Middl eName =@MiddleName,
CustomerName=@C ustomerName,Con tactPerson=@Con tactP erson,ContactTi tle=@ContactTit le,
Country=@Countr y,ParishOrState =@ParishOrState ,Dist rictOrCity=@Dis trictOrCity,Com munityOrTownShi p=@Co mmunityOrTownSh ip,
Street=@Street, TelephoneNumber s=@TelephoneNum bers, CellPhoneNumber s=@CellPhoneNum bers,
EmailAddress=@E mailAddress,Pho to=@Photo,Custo merCa tegory=@Custome rCategory,
CustomerIdentif icationIssuingI nstitution=@Cus tomer IdentificationI ssuingInstituti on,
CustomerIdentif icationIssuingC ountry=@Custome rIden tificationIssui ngCountry,Custo merIdentificati onExp irationDate=@Cu stomerIdentific ationExpiration Date,
CustomerIdentif icationCategory =@CustomerIdent ifica tionCategory,Co mments=@Comment s,Occupation=@O ccupa tion,DateofBirt h=@DateofBirth,
TaxRegistration Number=@TaxRegi strationNumber, LastT radeDate=@LastT radeDate,LastTr adeValue=@LastT radeV alue,
LastTradeType=@ LastTradeType,T raderAssignedTo Accou nt=@TraderAssig nedToAccount,Di scountPuchaseTr ade=@ DiscountPuchase Trade,
DiscountSaleTra de=@DiscountSal eTrade,MinimumP uchas eTradeValueForD iscount=@Minimu mPuchaseTradeVa lueFo rDiscount,
MinimumSaleTrad eValueForDiscou nt=@MinimumSale Trade ValueForDiscoun t,Active=@Activ e,CompanyCode=@ Compa nyCode,Location Code=@LocationC ode,
BranchCode=@Bra nchCode,OwnerCo de=@OwnerCode,D ateTi meCreated=@Date TimeCreated,Dat eTimeModified=@ DateT imeModified,
CreatedByUser=@ CreatedByUser,M odifiedByUser=@ Modif iedByUser,Sourc eOfFunds=@Sourc eOfFunds
WHERE CustomerCode = @CustNum
END
IF @@ROWCOUNT <> 0
BEGIN
INSERT INTO
SysDatabase_Tra nsactions( Record_Id,Table Name,Operation, TransferDateTim e)
SELECT b.CustomerCode, 'Customer','U', Getdate()
FROM Inserted b
END
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=@C ustomerCode,Cus tomerIdentifica tionT ype=@CustomerId entificationTyp e ,
CustomerIdentif icationGroupCod e=@CustomerIden tific ationGroupCode, DocumentNumber= @DocumentNumber ,
FirstName=@Firs tName,LastName= @LastName,Middl eName =@MiddleName,
CustomerName=@C ustomerName,Con tactPerson=@Con tactP erson,ContactTi tle=@ContactTit le,
Country=@Countr y,ParishOrState =@ParishOrState ,Dist rictOrCity=@Dis trictOrCity,Com munityOrTownShi p=@Co mmunityOrTownSh ip,
Street=@Street, TelephoneNumber s=@TelephoneNum bers, CellPhoneNumber s=@CellPhoneNum bers,
EmailAddress=@E mailAddress,Pho to=@Photo,Custo merCa tegory=@Custome rCategory,
CustomerIdentif icationIssuingI nstitution=@Cus tomer IdentificationI ssuingInstituti on,
CustomerIdentif icationIssuingC ountry=@Custome rIden tificationIssui ngCountry,Custo merIdentificati onExp irationDate=@Cu stomerIdentific ationExpiration Date,
CustomerIdentif icationCategory =@CustomerIdent ifica tionCategory,Co mments=@Comment s,Occupation=@O ccupa tion,DateofBirt h=@DateofBirth,
TaxRegistration Number=@TaxRegi strationNumber, LastT radeDate=@LastT radeDate,LastTr adeValue=@LastT radeV alue,
LastTradeType=@ LastTradeType,T raderAssignedTo Accou nt=@TraderAssig nedToAccount,Di scountPuchaseTr ade=@ DiscountPuchase Trade,
DiscountSaleTra de=@DiscountSal eTrade,MinimumP uchas eTradeValueForD iscount=@Minimu mPuchaseTradeVa lueFo rDiscount,
MinimumSaleTrad eValueForDiscou nt=@MinimumSale Trade ValueForDiscoun t,Active=@Activ e,CompanyCode=@ Compa nyCode,Location Code=@LocationC ode,
BranchCode=@Bra nchCode,OwnerCo de=@OwnerCode,D ateTi meCreated=@Date TimeCreated,Dat eTimeModified=@ DateT imeModified,
CreatedByUser=@ CreatedByUser,M odifiedByUser=@ Modif iedByUser,Sourc eOfFunds=@Sourc eOfFunds
WHERE CustomerCode = @CustNum
END
IF @@ROWCOUNT <> 0
BEGIN
INSERT INTO
SysDatabase_Tra nsactions( Record_Id,Table Name,Operation, TransferDateTim e)
SELECT b.CustomerCode, 'Customer','U', Getdate()
FROM Inserted b
END
Comment