Back
I want only Time from the DateTime column using SQL query using SQL Server 2005 and 2008.
Default output:
AttDate == 2011-02-09 13:09:00 2011-02-09 14:10:00
AttDate ==
2011-02-09 13:09:00
2011-02-09 14:10:00
I want the output to be:
AttDate Time == 2011-02-09 13:09:00 13:09 2011-02-09 14:10:00 14:10
AttDate Time ==
2011-02-09 13:09:00 13:09
2011-02-09 14:10:00 14:10
SQL Server 2008:
SELECT cast(AttDate as time) [time]FROM yourtable
SELECT cast(AttDate as time) [time]
FROM yourtable
Earlier versions:
SELECT convert(char(5), AttDate, 108) [time]FROM yourtable
SELECT convert(char(5), AttDate, 108) [time]
Interested in SQL ? Check out this SQL Certification by Intellipaat.
For more information visit :
31k questions
32.8k answers
501 comments
693 users