UFN_BBNC_GETCOUNTRYNAME
Return
Return Type |
---|
nvarchar(200) |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@COUNTRY | nvarchar(100) | IN |
Definition
Copy
CREATE function dbo.UFN_BBNC_GETCOUNTRYNAME(@COUNTRY nvarchar(100))
returns nvarchar(200)
as
begin
declare @COUNTRYNAME nvarchar(200);
if ( TRY_CAST(@COUNTRY as UNIQUEIDENTIFIER)?IS?NOT?NULL) and exists (select 1 from dbo.COUNTRY where ID = @COUNTRY)
begin
select @COUNTRYNAME= DESCRIPTION from dbo.COUNTRY where ID=@COUNTRY
end
else
begin
if @COUNTRY is not null
select
@COUNTRYNAME = [DESCRIPTION]
from
dbo.COUNTRY
where
[DESCRIPTION] = @COUNTRY;
if @COUNTRYNAME is null
select
@COUNTRYNAME = [DESCRIPTION]
from
dbo.COUNTRY
where
[ABBREVIATION] = @COUNTRY;
end
return @COUNTRYNAME;
end