Question : how can I get only the time from a datetime column that stores a bunch of datetimes

I have a column in a table which stores dates and times how can I query that table so that I get only the time portion
on the web I only found ways to get the current time with
CONVERT(VARCHAR,getdate(),108)
but that is not what I want I want to query a specific column
vb.net 2008 express

Answer : how can I get only the time from a datetime column that stores a bunch of datetimes

If you just want hours and minutes:


SELECT substring(CONVERT( varchar, yourfield, 100), 13, 7) from yourtable

if you want hours, minutes and seconds


SELECT stuff(substring(convert(varchar, yourfield, 109),13,100),9, 4, '') from yourtable

Random Solutions  
 
programming4us programming4us