Freigeben über


14 New Functions and 1 Changed Function in Denali

Microsoft SQL Server 2012 Release Candidate 0 (RC 0) introduces 14 new built-in
functions. These functions ease the path of migration for information workers by
emulating functionality that is found in the expression languages of many
desktop applications. However these functions will also be useful to experienced
users of SQL Server.

Those functions can be found in below Link:-https://msdn.microsoft.com/en-us/library/cc645577(v=SQL.110).aspx

Just for curiosity, lets me mention here two functions(IIF and CONCAT).

IIF : -
Returns one of two values, depending on whether the Boolean
expression evaluates to true or false.

DECLARE @a int = 45;
DECLARE @b int = 40;
SELECT IIF ( @a > @b,
'TRUE', 'FALSE' ) AS Result;

CONCAT : -

SELECT CONCAT ( 'Happy ', 'Birthday ', 11, '/', '25' ) AS
Result;

Here is the result set.
-------------------------
Happy
Birthday 11/25

CONCAT with NULL values

CREATE TABLE #temp (
    emp_name nvarchar(200) NOT NULL,
   
emp_middlename nvarchar(200) NULL,
    emp_lastname nvarchar(200) NOT
NULL
);
INSERT INTO #temp VALUES( 'Name', NULL, 'Lastname' );
SELECT
CONCAT( emp_name, emp_middlename, emp_lastname ) AS Result
FROM
#temp;

Here is the result set.
------------------
NameLastname