how to solve 1753 year issue in sqlserver?
I am using sqlserver to store/search. The problem is I have a form which takes start date and end date to search. If I enter dates after 1753 then no problem. If I enter any date below 1752, I am getting the below exception:
I know sql server supports date range b/w 1753 and 9999. But I cannot prevent the user from entering dates below 1753. Please help me.
If you need to store dates before 1753 in SQL Server 2005, then you’re going to have to store it as text.
If you’re storing the date only (no time component), then I’d recommend:
Which should force it to closely resembly a valid date (in
If you need to include a time component, I’d recommend storing it in
The formats I’ve recommended above are safely convertible to datetimes without having to consider regional settings.
You can also write stricter check constraints, if needed (e.g. the above does allow a 14th month, for example)