USP_ATTRIBUTE_UPDATEQUERYVIEWRELATIONSHIPS

Executes the "Attribute Query View Relationships: Update" record operation.

Parameters

Parameter Parameter Type Mode Description
@ID nvarchar(1) IN Input parameter indicating the ID of the record being updated.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the update.

Definition

Copy


CREATE procedure dbo.USP_ATTRIBUTE_UPDATEQUERYVIEWRELATIONSHIPS
(
    @ID nvarchar,
    @CHANGEAGENTID uniqueidentifier
)
as
    set nocount on;

    declare @ATTRIBUTEID uniqueidentifier

    -- declare a cursor that returns all smart field IDs

    declare attribute_cursor cursor local FAST_FORWARD for
        select ID from dbo.ATTRIBUTECATEGORY

    OPEN attribute_cursor

    FETCH NEXT from attribute_cursor
    into @ATTRIBUTEID

    -- Check @@FETCH_STATUS to see if there are any more rows to fetch.

    WHILE @@FETCH_STATUS = 0
    begin
        begin try
            -- update query view relationships for the smart field

            exec dbo.USP_ATTRIBUTE_UPDATEATTRIBUTEQUERIES @ATTRIBUTEID , 0, @CHANGEAGENTID 
        end try

        begin catch
            CLOSE attribute_cursor
            DEALLOCATE attribute_cursor                    
            exec dbo.USP_RAISE_ERROR;
            return 1;
        end catch

        FETCH NEXT from attribute_cursor into @ATTRIBUTEID
    end

    CLOSE attribute_cursor
    DEALLOCATE attribute_cursor