UFN_CONSTITUENT_GETPOSTCODE
Returns the primary post code for a constituent.
Return
Return Type |
---|
nvarchar(12) |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@CONSTITUENTID | uniqueidentifier | IN |
Definition
Copy
create function dbo.UFN_CONSTITUENT_GETPOSTCODE
(
@CONSTITUENTID uniqueidentifier
)
returns nvarchar(12)
as
begin
declare @POSTCODE nvarchar(12);
select top 1
@POSTCODE = POSTCODE
from dbo.ADDRESS
where ISPRIMARY = 1 and CONSTITUENTID = @CONSTITUENTID;
if @POSTCODE is null
set @POSTCODE = '';
return @POSTCODE;
end