Friday, July 13, 2007

Summer SQL Teaser: Datetime

First create this table

CREATE TABLE #DateMess (SomeDate datetime)
INSERT #DateMess VALUES('20070710')
INSERT #DateMess VALUES('20070711')
INSERT #DateMess VALUES('20070712')
INSERT #DateMess VALUES('20070713')


This should be easy for most people, but not everyone knows this.
Without running the query do you know how many rows you will get back from the query

SELECT *
FROM #DateMess
WHERE SomeDate <= '2007-07-12 23:59:59.999'


I created this teaser because of a response that Celko made here:
http://groups.google.com/group/microsoft.public.sqlserver.programming/browse_thread/thread/345a73f93cf6a684/

No comments: