Forum Moderators: open
I imported time data only (using import from a .csv file) and ended up with values such as "12/30/1899 11:00:00 AM"
This article looked interesting but when I applied these changes to a copy of the target table, my import would not work:
[weblogs.sqlteam.com...]
Next I tried applying the proposed changes to the table into which I had originally imported the data, but nothing changed - the dates still appear alongside the times, and I am not allowed to delete the dates.
Could anyone point me into the right direction to store ONLY time data in a column please?
Thanks much.
ALTER TABLE mytable
ADD timeonly AS (str(datepart(hour,[datetimefield]),2) + ':' + str(datepart(minute,[datetimefield]),2) + ':' + str(datepart(second,[datetimefield]),2))
You could then query:
SELECT datetimefield, timeonly FROM mytable