The scenario is this: select max date from some table, when the target table having no data, so the max date is null. when the date being null, I want to get the earliest date of system, so the epoch time seems perfect.
I have searched some ways including DATEADD functions, but that seems not elegant.
If I understand your question correctly, in SQL Server the epoch is given by cast(0 as datetime)
:
select Max(ISNULL(MyDateCol, cast(0 as datetime)))
from someTable
group by SomeCol