RightStr SQL Function to get left side of sub string

The RightStr(String Or Value , Length) is same but starts count from end of string, this function takes two arguments a string or value and number of characters, it returns the number of characters defined as second parameter of first value starting from end of string. The B or number of characters should be between 0 and length of value other wise a NULL is returned. Function only works with Text and Integer type values to work with other values see SubStr function.

        SELECT RightStr('SQLDatabase.Net', 3) /* returns : "Net" */;
        

SELECT RightStr(1234, 3) /* returns : "234" */;

RightStr is useful to get part of value for comparing e.g. Last Four Digits of Social Security Number.