here is the situation, I have a front end that calls this SP, any data that I change it brings over ok, But if I dont change it, it deletes the info from the row. So for instance, if I change the CustomerName, it changes the name and updates the table, But then it deletes all the other rows.
Does anyone have an idea how to fix this? Maybe if I write a temp db copying out the row, then copying it back, but that wouldn't keep the change I made. Can anyone Help?
CREATE PROCEDURE p_updateCustomer
(
@CustomerNumber varchar(7),
@CustomerName varchar(30),
@ContactCode varchar(10),
@AddressLine1 varchar(30),
@AddressLine2 varchar(30),
@AddressLine3 varchar(30),
@City varchar(20),
@State varchar(2),
@ZipCode varchar(10),
@CountryCode varchar(3),
@PhoneNumber varchar(17),
@FaxNumber varchar(17),
@Division varchar(2),
@TermsCode varchar(2),
@EmailAddress varchar(50),
@URLAddress varchar(50),
@CreditLimit decimal(19,7),
@AccountId varchar(50)
)
AS
BEGIN
UPDATE AR1_CustomerMaster SET
CustomerNumber = @CustomerNumber,
CustomerName = @CustomerName,
ContactCode = @ContactCode,
AddressLine1 = @AddressLine1,
AddressLine2 = @AddressLine2,
AddressLine3 = @AddressLine3,
City = @City,
State = @State,
ZipCode = @ZipCode,
CountryCode = @CountryCode,
PhoneNumber = @PhoneNumber,
FaxNumber = @FaxNumber,
Division = @Division,
TermsCode = @TermsCode,
EmailAddress = @EmailAddress,
URLAddress = @URLAddress,
CreditLimit = @CreditLimit
WHERE AccountId = @AccountId
END
Does anyone have an idea how to fix this? Maybe if I write a temp db copying out the row, then copying it back, but that wouldn't keep the change I made. Can anyone Help?
CREATE PROCEDURE p_updateCustomer
(
@CustomerNumber varchar(7),
@CustomerName varchar(30),
@ContactCode varchar(10),
@AddressLine1 varchar(30),
@AddressLine2 varchar(30),
@AddressLine3 varchar(30),
@City varchar(20),
@State varchar(2),
@ZipCode varchar(10),
@CountryCode varchar(3),
@PhoneNumber varchar(17),
@FaxNumber varchar(17),
@Division varchar(2),
@TermsCode varchar(2),
@EmailAddress varchar(50),
@URLAddress varchar(50),
@CreditLimit decimal(19,7),
@AccountId varchar(50)
)
AS
BEGIN
UPDATE AR1_CustomerMaster SET
CustomerNumber = @CustomerNumber,
CustomerName = @CustomerName,
ContactCode = @ContactCode,
AddressLine1 = @AddressLine1,
AddressLine2 = @AddressLine2,
AddressLine3 = @AddressLine3,
City = @City,
State = @State,
ZipCode = @ZipCode,
CountryCode = @CountryCode,
PhoneNumber = @PhoneNumber,
FaxNumber = @FaxNumber,
Division = @Division,
TermsCode = @TermsCode,
EmailAddress = @EmailAddress,
URLAddress = @URLAddress,
CreditLimit = @CreditLimit
WHERE AccountId = @AccountId
END