I want to create a function in SQL Server which was created in Postgresql can you suggest me to write same function in SQL Server? This function results the remaining instal