There are only a datetime and smalldatetime datatypes. These types always store both a date and a time. You can't change that.
If you assign a value to a datetime type and use only a date, then the system will automatically assign a time of midnight. If you only assign a time, then the date will be automatically assigned a value of '1/1/1900'.
When you manipulate these columns, you simply ignore the portion you dont care about. Thus, store a time in a datetime column by:
Code:
UPDATE Yourtable SET YourTimeColumn='13:14:15' WHERE ...
will set the YourTimeColumn value to 15 seconds past 14 minutes past 1 PM on Jan 1, 1900. You can use a variety of formats to specify a datetime, such as hh:mm:ss or hh:mm:ss AM/PM, etc. See 'datetime data type, formats' in BOL.
To extract just the time portion from a datetime datatype, use the CONVERT function, e.g:
Code:
SELECT CONVERT(char(8),YourTimeColumn,8)
will return the time as a string in hh:mm:ss format. Again, see BOL for the CONVERT function.
Jeff Mason
Custom Apps, Inc.
www.custom-apps.com