The customer name isn't saved in Customer Maintenance (08.260.00)

This article provides a solution to an issue where the customer name isn't saved in Customer Maintenance.

Applies to:   Microsoft Dynamics SL 2011, Microsoft Dynamics SL 2011 Service Pack 1
Original KB number:   3047916

Cause

A trigger is missing the set nocount on statement. Which stops the message that shows the count of the number of rows affected by a Transact-SQL statement or stored procedure from being returned as part of the result set.

Resolution

Run the following SQL statement in SQL Server Management Studio on the application database.

alter TRIGGER ADG_TR_CustNameXref_Add ON dbo.Customer  
FOR INSERT,UPDATE
AS
set nocount on
 DECLARE @CustID varchar(15)
 DECLARE @Name varchar(30)
 DECLARE @RowsAffected int

 SELECT @RowsAffected = @@ROWCOUNT

 IF @RowsAffected = 1
 BEGIN

  IF UPDATE(Name)
  BEGIN
   SELECT @CustID = CustID, @Name = Name from DELETED
   EXECUTE ADG_CustNameXref_Delete @CustID, @Name

   SELECT @CustID = CustID, @Name = Name from INSERTED
   EXECUTE ADG_CustNameXref_Add @CustID, @Name
  END
 END

 IF @RowsAffected > 1
 BEGIN

  IF UPDATE(Name)
  BEGIN

   DECLARE DelCursor SCROLL CURSOR FOR SELECT CustID, Name FROM DELETED

   OPEN DelCursor

   FETCH FIRST FROM DelCursor INTO @CustID, @Name

   WHILE (@@FETCH_STATUS = 0)
   BEGIN
    EXECUTE ADG_CustNameXref_Delete @CustID, @Name

    FETCH NEXT FROM DelCursor INTO @CustID, @Name

   END

   CLOSE DelCursor
   DEALLOCATE DelCursor

   DECLARE InsCursor SCROLL CURSOR FOR SELECT CustID, Name FROM INSERTED

   OPEN InsCursor

   FETCH FIRST FROM InsCursor INTO @CustID, @Name

   WHILE (@@FETCH_STATUS = 0)
   BEGIN
    EXECUTE ADG_CustNameXref_Add @CustID, @Name
  
    FETCH NEXT FROM InsCursor INTO @CustID, @Name

   END

   CLOSE InsCursor
   DEALLOCATE InsCursor
  END
 END