I have followin table schema
declare @temp table
(
id int identity(1,1) not null,
nod nvarchar(50)
)
in which nod column have following data
insert into @temp select 'N/A'
insert into @temp select 'N/A'
insert into @temp select '5'
insert into @temp select 'N/A'
insert into @temp select '7'
insert into @temp select 'N/A'
insert into @temp select '31'
insert into @temp select '15'
i want that select stament shoud give me result on following basis
if nod value 'N/A' then it should show 'N/A'
or if there any numeric value like 5,15,31 then it should show getdate()-nod date date column
I have tried following but fail to minus the days and also represent 'N/A' when 'N/A' in that nvarchar column
select DATEADD(dd,case nod when 'N/A' then 0 else nod end,GETDATE()) from @temp
The following query would return a
VARCHAR(50)column that contains either ‘N/A’ ornow - noddate as varchar.