datetime - SQL Server function to return minimum date (January 1, 1753) -


i looking sql server function return minimum value datetime, namely january 1, 1753. i'd rather not hardcode date value script.

does exist? (for comparison, in c#, datetime.minvalue) or have write myself?

i using microsoft sql server 2008 express.

you write user defined function returns min date value this:

select cast(-53690 datetime) 

then use function in scripts, , if ever need change it, there 1 place that.

alternately, use query if prefer better readability:

select cast('1753-1-1' datetime) 

example function

create function dbo.datetimeminvalue() returns datetime begin     return (select cast(-53690 datetime)) end 

usage

select dbo.datetimeminvalue() datetimeminvalue  datetimeminvalue ----------------------- 1753-01-01 00:00:00.000 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -