SQL Server Function Emulations