Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.0 » UltraLite - Database Management and Reference » UltraLite SQL Reference » UltraLite SQL function reference » Alphabetical list of functions

 

SIMILAR function [String]

Returns a number indicating the similarity between two strings.

Syntax
SIMILAR( string-expression-1, string-expression-2 )
Parameters
  • string-expression-1   The first string to be compared.

  • string-expression-2   The second string to be compared.

Remarks

The function returns an integer between 0 and 100 representing the similarity between the two strings. The result can be interpreted as the percentage of characters matched between the two strings. A value of 100 indicates that the two strings are identical.

This function can be used to correct a list of names (such as customers). Some customers may have been added to the list more than once with slightly different names. Join the table to itself and produce a report of all similarities greater than 90 percent, but less than 100 percent.

The calculation performed for the SIMILAR function is more complex than just the number of characters that match.

See also
Standards and compatibility
  • SQL/2003   Vendor extension.

Example

The following statement returns the value 75, indicating that the two values are 75% similar.

SELECT SIMILAR( 'toast', 'coast' );