spBulkUpdate_AttribsToApplicationFields

Parameters

Parameter Parameter Type Mode Description
@AttribFieldID int IN
@ParentFieldID int IN
@ClientsID int IN
@XML ntext IN

Definition

Copy


    CREATE   PROCEDURE [dbo].[spBulkUpdate_AttribsToApplicationFields]
            (
            @AttribFieldID int,
            @ParentFieldID int,
            @ClientsID int,
            @XML ntext
            )
            AS
            DECLARE @idoc int

            EXEC sp_xml_preparedocument @idoc OUTPUT, @XML

            DELETE 
            FROM ApplicationFields
            WHERE FieldID=@AttribFieldID and clientsid=@clientsid

                INSERT INTO ApplicationFields
                (
                    FieldID,    
                    ParentFieldID ,
                    FieldName ,
                    Sequence ,
                    HasMultiples ,
                    ApplicationsID, 
                    Searchable ,
                    PrivateShowByDefault ,
                    NeverPrivate ,
                    FieldType ,
                    FormField ,
                    HTMLEncode ,
                    AttribTypeID, 
                    DataType ,
                    CodeTableID ,
                    AttribRequired ,
                    AttribRecordType ,
                    ClientsID
                )
                SELECT
                    @AttribFieldID
                    @ParentFieldID
                    FieldName, 
                    Sequence
                    0
                    1
                    Searchable, 
                    PrivateShowByDefault, 
                    0
                    FieldType, 
                    1
                    1,         
                    AttribTypeID, 
                    DataType ,
                    CodeTableID ,
                    AttribRequired ,
                    AttribRecordType,
                    @clientsID
            FROM OPENXML (@idoc, '/Attributes/Items/Item[@Selected="1"]',1
                WITH(
                    FieldID int,
                    FieldName nvarchar(50), 
                    FieldType int
                    SitePageID int,
                    AttribTypeID int
                    DataType int,
                    CodeTableID int,
                    AttribRequired bit,
                    AttribRecordType int,
                    Searchable bit,
                    PrivateShowByDefault bit,
                    Sequence int
                ) 


            EXEC sp_xml_removedocument @idoc