跳至主要內容

业务伙伴主数据:业务伙伴名称不能重复

五六零网校小于 1 分钟

注意

业务伙伴主数据:业务伙伴名称不能重复

代码示例

IF @object_type IN ( '2' )
            AND ( @transaction_type = 'A'
                  OR @transaction_type = 'u'
                )
            BEGIN
                DECLARE @cardname NVARCHAR(100)--客户名称
                DECLARE @cardtype NVARCHAR(1)--业务伙伴类型
                DECLARE @count1 NVARCHAR(10)
				DECLARE @KEY NVARCHAR(100)

                SELECT  @cardname = t1.CardName
                FROM    OCRD t1
                WHERE   t1.CardCode = @list_of_cols_val_tab_del
                SELECT  @cardtype = t1.CardType
                FROM    OCRD t1
                WHERE   t1.CardCode = @list_of_cols_val_tab_del

                SELECT  @count1 = COUNT(t2.CardCode)
                FROM    OCRD t2
                WHERE   t2.CardName = @cardname
                        AND t2.CardType = @cardtype

      
                IF @count1 > 1
                    BEGIN 
                        SET @error = 1
                        SET @error_message = N'业务伙伴名称:''' + @cardname 
                            + N'''业务伙伴已存在,请检查!'
                    END
            END