The reason for what you are observing is that datetime is not stored as a string in the database. The internal representation for datetime is an 8-byte float that includes the date part and time part.
If you are looking for all the rows which have the date part = 2012-10-04, query it like this:SELECT * FROM #t
WHERE a >= '20121004' AND a < '20121005';