Click here to Skip to main content
15,884,010 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sql server 2008 Concatenate successful Running but Sql server 2005 Not Concatenate This Below Query.

SQL
DECLARE @fromdate Date
DECLARE @ShiftStart varchar(60)='09:00'
select @fromdate=CONVERT(VARCHAR(10),'2014-12-16 10:18:00.000',101) 
SELECT  CAST(@fromdate AS DATETIME) + CAST(@ShiftStart AS DATETIME) 

The Above query wise how to concatenate(date and time)in sql server 2005.

I want concatenate(date and time) Result is 2014-12-16 09:00:00.000.

Thanks
Posted
Updated 29-Jan-15 20:13pm
v2
Comments
Zoltán Zörgő 30-Jan-15 3:30am    
But why are you adding time part trimester variable? What should happen with that?

1 solution

try.
SQL
SELECT CAST((CAST(your_date_column AS DATE) AS DATETIME) +
    CAST(your_time_column AS TIME)) as Datetime)
FROM your_table
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900