I have a stored procedure like so:
select
TransactionDate
from
(select
cast(TransactionDate as Date) as TransactionDate
from RetailTransaction) t
However this makes the TransactionDate column of the outer-select nullable, while RetailTransaction.TransactionDate column is not null.
RetailTransaction.TransactionDate definition / design:
Inner Select:
Outer Select:
Even after adding isnull or coalesce SQL Server / SSMS still shows that the outer selects TransactionDate column is still nullable.
select
TransactionDate
from
(select
isnull(cast(TransactionDate as Date), getdate()) as TransactionDate
from
RetailTransaction) t
How do I make the TransactionDate column non nullable?
Note that the database is on Azure with compatibility level 100 (SQL Server 2008).
EDIT:
Adding an isnull on the outer select still make the column nullable to an outer-nested-query:






