Refer the below link to learn about SQL Server 2012 new feature Data Quality Services (DQS)
http://technet.microsoft.com/en-us/sqlserver/hh780961.aspx
http://technet.microsoft.com/en-us/sqlserver/hh780961.aspx
In this example, we will evaluate the values of two
variables and return the result of a variable which is bigger in value.
|
DECLARE @A INT=40
DECLARE @B INT=30
SELECT IIF(@A > @B, 'A IS GREATER THAN B', 'B IS GREATER THAN A')
GO;
Executing the above T-SQL will return the
following result:
-------------------
A IS GREATER THAN B
(1 row(s) affected)
|
In this example, we will evaluate the age of John and
Julie and identify who is older between them. Please observe the use of sub
functions within IIF.
|
DECLARE @JOHN_AGE INT=35
DECLARE @JULIE_AGE INT=29
SELECT IIF(@JOHN_AGE > @JULIE_AGE, 'JOHN IS OLDER THAN JULIE
BY '+LTRIM(STR(@JOHN_AGE-@JULIE_AGE))+' YEARS', 'JULIE IS OLDER THAN JOHN
BY '+LTRIM(STR(@JULIE_AGE-@JOHN_AGE))+' YEARS')
GO;
Executing the above statement will return the follocwing
result:
--------------------------------------------
JOHN IS OLDER THAN JULIE BY 6 YEARS
(1 row(s) affected)
|