[thelist] SQL: Select first item for each person for each day

Ken Schaefer Ken at adOpenStatic.com
Tue Feb 24 21:22:25 CST 2009


SQL Server 2000 stores datetime fields as two numbers - one for days since 1/1/1900 and one for the number of milliseconds since midnight. Casting to int seems to drop the time part...

Cheers
Ken

-----Original Message-----
From: thelist-bounces at lists.evolt.org [mailto:thelist-bounces at lists.evolt.org] On Behalf Of Anthony Baratta
Sent: Wednesday, 25 February 2009 12:11 PM
To: thelist at lists.evolt.org
Subject: Re: [thelist] SQL: Select first item for each person for each day

Ken Schaefer wrote:
> 	CAST(b.Appointment_Date AS Int) = CAST(GetDate() AS Int)

That's an interesting shortcut!

I would think that is time fluxing too, but testing shows me otherwise. 
Looks like that is the number of days since 01-01-1900.

Guess we only have to worry about SQL integer overflow in 5.8 million 
years. But the SQL Date field will over flow by year 10,000 anyway, so 
it's a moot point. :-)

Thanks for the info.



--
Anthony Baratta

Gollum: verb
To obsessively and compulsively covet without the ability to enjoy that 
which you covet.

-- 

* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 



More information about the thelist mailing list