I have a view on SQL 2012 where I am trying to concatenate 2 nvarchar columns. It returns nulls if one of the values are null.
I have tried the concat function, I have tried SET CONCAT_NULL_YIELDS_NULL OFF I have tried to use isnull(column name) but still it is returning nulls
Here is my query:
SELECT TOP (100) PERCENT Assignment ,[Document Number]+[Dunning Block] AS [Document Number] ,[Document Type] ,[Document Date] ,[Special G/L Indicator] ,[Amount in local currency] ,[Local Currency] ,[Clearing Document] ,Text ,Account ,Reference ,[Dunning block] ,[Invoice reference] ,SUBSTRING(strDoc_Date, 1, 4) AS Year ,CASE WHEN SUBSTRING(strDoc_Date, 1, 4) = '2013' THEN CASE WHEN SUBSTRING(strDoc_Date, 6, 2) = '01' THEN CASE WHEN CAST(SUBSTRING(strDoc_Date, 9, 2) AS integer) > 25 THEN '02' ELSE SUBSTRING(strDoc_Date, 6, 2) END ELSE SUBSTRING(strDoc_Date, 6, 2) END ELSE SUBSTRING(strDoc_Date, 6, 2) END AS Period , SUBSTRING(strDoc_Date, 9, 2) AS Day FROM dbo.Zcustage Any suggestions would be appreciated.