次のテーブルスキーマがあります
declare @temp table
(
id int identity(1,1) not null,
nod nvarchar(50)
)
どのnod
列に次のデータがありますか
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'
select stment shoud が次の基準に基づいて結果を返すことを望みます
nod
値の場合'N/A'
、表示する必要があります'N/A'
または、5,15,31 のような数値がある場合は、getdate()-nod date
日付列を表示する必要があります
私は次のことを試みましたが、日を差し引くことができず、その nvarchar 列'N/A'
にいつ表示されますか'N/A'
select DATEADD(dd,case nod when 'N/A' then 0 else nod end,GETDATE()) from @temp