USP_SIMPLEDATALIST_SPONSORSHIPREASONQUERY

Displays a list of reasons by filtering on reason type.

Parameters

Parameter Parameter Type Mode Description
@TYPE int IN Type

Definition

Copy


CREATE procedure dbo.USP_SIMPLEDATALIST_SPONSORSHIPREASONQUERY
    (
     @TYPE int
    )
     as          

     if @TYPE = 0
     begin
        select distinct REASON as VALUE, REASON as LABEL
        from dbo.SPONSORSHIPREASON
        order by REASON;
     end
     else if @TYPE = 1
         begin select REASON as VALUE,     REASON as LABEL
           from    dbo.SPONSORSHIPREASON
           where REASONTYPECODE in (0,1)
           order by REASON
         end
     else if @TYPE = 2
      begin select REASON as VALUE, REASON as LABEL
           from dbo.SPONSORSHIPREASON
           where REASONTYPECODE in (3,4)
           order by REASON
      end
     else if @TYPE = 3
      begin 
       select REASON as VALUE, REASON as LABEL
           from dbo.SPONSORSHIPREASON
            --We should just take any reason.  This should encompass any future reasons that are added.

            --If the reasontype in the query list needs to be limited, uncomment the line below.

           --where REASONTYPECODE in (0,1,2,3,4,5,6,7,8,9,10,11)

           order by REASON
      end     
     else if @TYPE = 4
      begin 
       select REASON as VALUE, REASON as LABEL
           from dbo.SPONSORSHIPREASON
           where REASONTYPECODE in (2,10)
           order by REASON
      end