USP_CONFIGURATIONEXPORTPROCESS_VALIDATEINSTANCES

Checks that a configuration export instance is listed only once per parameter set.

Parameters

Parameter Parameter Type Mode Description
@INSTANCES xml IN

Definition

Copy


            create procedure dbo.USP_CONFIGURATIONEXPORTPROCESS_VALIDATEINSTANCES(@INSTANCES xml)
            with execute as caller
            as            
                declare @NAME nvarchar(250)
                declare @INSTANCESTABLE table
                        (
                            ID uniqueidentifier,
                            DISPLAYNAME nvarchar(250),
                            CONFIGURATIONDATACATALOGID uniqueidentifier
                        )

                insert into @INSTANCESTABLE(ID, DISPLAYNAME, CONFIGURATIONDATACATALOGID) 
                                                select 
                                                    INSTANCES.ID,
                                                    INSTANCES.DISPLAYNAME,
                                                    INSTANCES.CONFIGURATIONDATACATALOGID 
                                                from 
                                                    dbo.UFN_CONFIGURATIONEXPORT_GETPROCESSINSTANCES_FROMITEMLISTXML(@INSTANCES) as INSTANCES;

                /*if exists(select CONFIGURATIONDATACATALOGID from  @INSTANCESTABLE as INSTANCESTABLE group by CONFIGURATIONDATACATALOGID having count(CONFIGURATIONDATACATALOGID) > 1)*/
                select top 1 @NAME = DISPLAYNAME from  @INSTANCESTABLE as INSTANCESTABLE group by DISPLAYNAME, CONFIGURATIONDATACATALOGID having count(CONFIGURATIONDATACATALOGID) > 1

                if @NAME is not null begin                    
                    set @NAME = @NAME + ' is selected more than once.'
                    raiserror(@NAME, 13, 1);                                    
                end