I have a date filed 12/26/2006 and a time field 7:00am. How can I combine them in my select statement and get a DateTime field.
declare @.v1 varchar(20)
select @.v1 ='12/26/2006'
declare @.v2 varchar(20)
select @.v2 ='7:00am'
select convert(datetime,@.v1 + ' ' + @.v2)
but is safer to use the YYYYMMDD format for dates
Denis the SQL Menace
http://sqlservercode.blogspot.com/
No comments:
Post a Comment