Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

The customer name is not saved in Customer Maintenance (08.260.00)


View products that this article applies to.

Cause

A trigger is missing the set nocount on statement.  This 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.

↑ Back to the top


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 

↑ Back to the top


Keywords: kbmbsmigrate, kbmbspartner, kbsurveynew, kb

↑ Back to the top

Article Info
Article ID : 3047916
Revision : 2
Created on : 2/3/2017
Published on : 2/3/2017
Exists online : False
Views : 278