CREATE PROCEDURE dbo.GetUser @Id INT AS
BEGIN
    SELECT * FROM Users WHERE Id = @Id;
END
GO

CREATE FUNCTION dbo.Age(@DOB DATETIME)
RETURNS INT AS
BEGIN
    RETURN DATEDIFF(YEAR, @DOB, GETDATE());
END
GO

CREATE VIEW dbo.ActiveUsers AS
SELECT * FROM Users WHERE Active = 1;
GO