USP_SIMPLEDATALIST_STATE

Returns all states for the given country (or all countries if no country supplied).

Parameters

Parameter Parameter Type Mode Description
@INCLUDEINACTIVE bit IN Include inactive
@COUNTRYID uniqueidentifier IN Country
@USEDEFAULTCOUNTRY bit IN Use default country

Definition

Copy


CREATE procedure dbo.USP_SIMPLEDATALIST_STATE
(
    @INCLUDEINACTIVE bit = 0,
    @COUNTRYID uniqueidentifier = null,
  @USEDEFAULTCOUNTRY bit = 1
) as
    set nocount on;

    if @COUNTRYID is null and @USEDEFAULTCOUNTRY = 1
        exec @COUNTRYID = dbo.UFN_COUNTRY_GETDEFAULT;

    select
        ID as VALUE,
        DESCRIPTION as LABEL
    from dbo.STATE 
    where (ACTIVE=1 or @INCLUDEINACTIVE=1) and (COUNTRYID=@COUNTRYID or @COUNTRYID is null)
    order by DESCRIPTION;