Concatenation against NULL expressions + SQL Server 2012

Bandi
Posted by Bandi under Sql Server category on | Points: 40 | Views : 302

--Using CONCAT function
SELECT CONCAT(GETDATE(),2,NULL) AS ConcatAgainstNULL

output
ConcatAgainstNULL
Mar 20 2015 3:59PM2

--Using Plus Operator
SELECT GETDATE()+2+NULL AS PlusAgainstNULL

PlusAgainstNULL
NULL


CONCAT treats/converts the NULL operand/expression as EMPTY String whereas the PPLUS Operator treats NULL as unknown value. so any operation agaisnt NULL results NULL in case of Plus operator

Comments or Responses

Posted by: Nagamma on: 3/21/2015 Level:Starter | Status: [Member] | Points: 10
try to better...

Login to post response