Files
the-biergarten-app/archive/sql-stored-procs-functions/02-functions/UDF_GetCountryIdByCode.sql
2026-08-20 21:31:38 -04:00

16 lines
292 B
Transact-SQL
Vendored

CREATE OR ALTER FUNCTION dbo.UDF_GetCountryIdByCode(
@CountryCode NVARCHAR(2)
)
RETURNS UNIQUEIDENTIFIER
AS
BEGIN
DECLARE
@CountryId UNIQUEIDENTIFIER;
SELECT @CountryId = CountryID
FROM dbo.Country
WHERE ISO3166_1 = @CountryCode;
RETURN @CountryId;
END;