Files
the-biergarten-app/web/backend/Database/Database.Migrations/scripts/02-functions/UDF_GetCountryIdByCode.sql
2026-08-24 01:09:47 -04:00

16 lines
292 B
Transact-SQL

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;