Reverse a string without using REVERSE() function in SQL

Functions are created for to do a specific task in any language. eg: REVERSE() function (as its name suggests) reverses a string’s value. Every function have some logic behind that. Sometimes interviewer asked this question "Reverse a string without using REVERSE() function in sql or other language?". Find below code for String reverse without using T-SQL function.