Data fields varchar Type, format: 20110228 151010
To make time comparisons, search for a time in a range
SELECT * FROM table where '
20120102 ' < ' time ' < ' 20120109 '
SELECT * from ' table ' WHERE replace (' otime ', ' ', ') between ' 20120102 ' and ' 20120105 '
VARCHAR (n): variable-length character data type, stored for a maximum length of 8,000 characters
Variable-length, non-Unicode character data with a length of n bytes. n must be a numeric value between 1 and 8,000.
Storage size is the actual length of bytes of input data, not n bytes. The input data character length can be zero. The synonym for varchar in SQL-92 is char varying or character varying. Note If n is not specified in a data definition or variable declaration statement, the default length is 1. If n is not specified using the CAST function, the default length is 30.
If you want the data value in the column to be significantly different in size, use varchar.
For example, SQL Server2000, my software needs to be date 2009-10-19 10:16:54 save, then I tested, set the property of the field to varchar, the advantage is that it can set the length, when it is connected with other clients when the compatibility is good AH.
SQL Time Comparison