Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 joing times to date?

Author  Topic 

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2009-10-12 : 04:57:06
I have a @starttime='08:00'
Now i want to set datetime=getdate() but with the time of @starttime

how do I do that?

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-10-12 : 05:34:26
select cast (convert(varchar,getdate(),101)+' 08:00:00' as datetime)

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-10-12 : 08:12:35

select dateadd(day,datediff(day,0,getdate()), '08:00:00')

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -