USP_STATE_GETLIST
Gets a list of states for a given country.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@COUNTRYID | uniqueidentifier | IN | |
@INCLUDEINACTIVE | bit | IN |
Definition
Copy
create procedure dbo.USP_STATE_GETLIST(@COUNTRYID uniqueidentifier, @INCLUDEINACTIVE bit)
as begin
if dbo.UFN_GETLISTSORTMETHOD('STATE') = 0 begin
if @INCLUDEINACTIVE = 0 begin
if @COUNTRYID is null
select ID, ABBREVIATION, DESCRIPTION from dbo.STATE where (ACTIVE = 1) order by DESCRIPTION
else
select ID, ABBREVIATION, DESCRIPTION from dbo.STATE where (COUNTRYID = @COUNTRYID) and (ACTIVE = 1) order by DESCRIPTION
end else begin
if @COUNTRYID is null
select ID, ABBREVIATION, DESCRIPTION from dbo.STATE order by DESCRIPTION
else
select ID, ABBREVIATION, DESCRIPTION from dbo.STATE where (COUNTRYID = @COUNTRYID) order by DESCRIPTION
end
end else begin
if @INCLUDEINACTIVE = 0 begin
if @COUNTRYID is null
select ID, ABBREVIATION, DESCRIPTION from dbo.STATE where (ACTIVE = 1) order by SEQUENCE
else
select ID, ABBREVIATION, DESCRIPTION from dbo.STATE where (COUNTRYID = @COUNTRYID) and (ACTIVE = 1) order by SEQUENCE
end else begin
if @COUNTRYID is null
select ID, ABBREVIATION, DESCRIPTION from dbo.STATE order by SEQUENCE
else
select ID, ABBREVIATION, DESCRIPTION from dbo.STATE where (COUNTRYID = @COUNTRYID) order by SEQUENCE
end
end
end