USP_COUNTRYADDRESSFORMAT_GETDATA

Retrieves address formats for all countries.

Definition

Copy


CREATE procedure dbo.USP_COUNTRYADDRESSFORMAT_GETDATA
as begin
    declare @US uniqueidentifier
    declare @UK uniqueidentifier
    declare @CA uniqueidentifier
    declare @AU uniqueidentifier
    declare @NZ uniqueidentifier
    set @US='8472DB8F-EC57-4295-8B8F-B655BC7F4A26'
    set @UK='959809FB-8FA7-4A19-888F-9951BD9B29D3'
    set @CA='D473071F-DFF5-4F8D-8E4B-D90CB806D950'
    set @AU='B56E02E7-B334-44F8-B2F0-1E8F1BC59CAB'
    set @NZ='A3B050A5-E1C8-4E1B-99AE-40E9FCADA0BC'

    /* A blank caption will result in the field not being shown */

    /* Fields not handled here can be handled in the UI since the COUNTRYADDRESSFORMATID is supplied */

    select
        ID, 
        case ID 
            when @AU then 'Suburb'
            when @NZ then 'Suburb'
            else 'City'
        end CITYCAPTION,
        case ID 
            when @UK then 'County'
            when @CA then 'Province'
            when @NZ then 'City'
            else 'State'
        end STATECAPTION,
        case ID 
            when @US then 'ZIP'
            when @UK then 'Postcode'
            when @NZ then 'Post Code'
            when @AU then 'Postcode'
            when @CA then 'Postal Code'
            else 'Post code'
        end POSTCODECAPTION,
        case ID 
            when @UK then 'DPS'
            when @CA then ''
            when @AU then 'DPID'
            when @NZ then 'DPID'
            else 'DPC'
        end DPCCAPTION,
        case ID 
            when @UK then ''
            else 'CART'
        end CARTCAPTION,
        case ID 
            when @UK then ''
            when @AU then ''
            when @NZ then ''
            else 'LOT'
        end LOTCAPTION,        
        case ID
            when @UK then ''
            when @NZ then ''
            else 'County'
        end COUNTYCAPTION,
        case ID
            when @US then 'Congressional district'
            else ''
        end CONGRESSIONALDISTRICTCAPTION,
        case ID
            when @US then 'State house district'
            else ''
        end STATEHOUSEDISTRICTCAPTION,
        case ID
            when @US then 'State senate district'
            else ''
        end STATESENATEDISTRICTCAPTION,
        case ID
            when @US then 'Local precinct'
            else ''
        end LOCALPRECINCTCAPTION        
    from 
        dbo.COUNTRYADDRESSFORMAT

    return 0
end