Max SmallDateTime Value

According to the title of the article, you’re probably here for one reason, to find the maximum value for a smalldatetime.

Here it is:

2079-06-06 23:59:00

And the Minimum is:

1900-01-01 00:00:00

And here’s the proof:

[cc lang=”sql”]
DECLARE @smalldatetime SMALLDATETIME

SET @smalldatetime = GETDATE()

WHILE 1 = 1
BEGIN
BEGIN TRY
SET @smalldatetime = DATEADD(dd,1,@smalldatetime)
END TRY
BEGIN CATCH
WHILE 1 = 1
BEGIN
BEGIN TRY
SET @smalldatetime = DATEADD(mi,1,@smalldatetime)
END TRY
BEGIN CATCH
SELECT @smalldatetime
BREAK
END CATCH

END
BREAK;
END CATCH
END
[/cc]

The precision for smalldatetime is 1 minute. Meaning that you can only specify minute intervals.

If you stumbled on this article and are wondering why someone might want the max smalldatetime, here’s a possible use.

Say you have an effective date for a record. By this, I mean that this particular record is active from x date to y date. If the current day falls outside of that range, then this record is no longer active.

So if you do not want to define an end date that the record is effective for (meaning it is always active), the best way to do this, would be to insert the maximum smalldatetime in order to signify, “always effective”.

2079 not long enough of a time for you? Hmm.. either you are a purist or somehow think you will be around that long, or are VERY devoted to your company. In any case, use Max datetime value instead.

3 comments
chuck 31 Oct 2011 at 12:03 pm

Or you handle 60 years long lease land contracts.

kennyshu 03 Mar 2011 at 3:41 pm

Very helpful. Thanks!

Anghelo 29 Aug 2015 at 7:20 am

Distinct meal is very easy that running brofeoat solitary requests oneparticular have definitely # 2 icy plums (diced hooked on many timesgroups or simply sections) also One particular coffee mug ofsunshine coconut whole milk on hand. The majority of the juicer review sites I’ve really evaluate web have the same large choice of discourse exactly excessive or sometimes unobtrusive a machine is the way it is loop uses in his or her quarters. There is an Rr Device 9000 chrome steel juice extractor, which will come accompanied by Sixteen season deserve, powerful 15 HP induction algorithm, 400 watts linked with purely natural capability, and a excellent speed up 3600 RPM for peak competences. The additional advantage is that you get to continue to keep most nutrients whilst enzymes who are necessary to good physical condition. Be certain to to begin with searching . your going use how the machine to suit, the most recent positive aspects effectively as the types of juicing.

Featured Articles

 Site Author

  • Thanks for visiting!