Please visit DEMANDDRAFT.SHOP for quality of products...

Ad

Search This Blog

Tuesday, July 17, 2012

DIFFERENCE Function in SQL Server

DIFFERENCE()

Returns an integer value that indicates the difference between the SOUNDEX values of two character expressions.

Syntax
DIFFERENCE ( character_expression , character_expression )
 
Arguments:character_
expression: Is an expression of type char or varchar. character_expression can also be of type text; however, only the first 8,000 bytes are significant.

Return Types:  Int

Example :

USE AdventureWorks;

GO
-- Returns a DIFFERENCE value of 4, the least possible difference.
SELECT SOUNDEX('Green'), SOUNDEX('Greene'), DIFFERENCE('Green','Greene');
GO
-- Returns a DIFFERENCE value of 0, the highest possible difference.
SELECT SOUNDEX('Blotchet-Halls'), SOUNDEX('Greene'), DIFFERENCE('Blotchet-Halls', 'Greene');
GO

Output:
----- ----- -----------
G650  G650  4          

(1 row(s) affected)
                       
----- ----- -----------
B432  G650  0          

(1 row(s) affected)

No comments:

Post a Comment