[thelist] New annoying feature of SQL Server

Anthony Baratta Anthony at Baratta.com
Fri Jan 3 11:11:01 CST 2003

At 08:38 AM 1/3/2003, Rob Smith wrote:
>Real quick, I've just started recording when and who accesses my company
>Intranet via an INSERT query (in ASP 2.0):
>Dim ThaTime, DateToday
>ThaTime = Time
>DateToday = Date
>IntranetLog.Source = "INSERT INTO IntranetLog (UserID, DateAccessed,
>TimeAccessed) VALUES ('" & userID & "', '" & DateToday & "', '" & ThaTime &
>Ok. When I go into my DB, and look at the TimeAccessed column I get this:
>...   ...
>...   1/1/1900 9:24:09 AM

Don't split the Date and Time into Columns. MS SQL only understands
DateTime, not Date and Time separately. Since you are not passing a date to
the "time" column SQL needs to insert something and the default is 1/1/1900.

Since you'll have to split or carve the time off anyway, I just combine the
two into a single column.
Anthony Baratta
Keyboard Jockeys

"Conformity is the refuge of the unimaginative."

More information about the thelist mailing list