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)
 Date minus Date

Author  Topic 

Exir
Posting Yak Master

151 Posts

Posted - 2008-11-08 : 02:57:18
I have two field in my table where data type of both are date/time.
I want to deduce these two fields and if the result be more than 48 hours, fill other field of table by "delay" or "yes" or anything else. how can i do this?

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2008-11-08 : 03:31:16
use datediff() function , for more details read carefully
http://msdn.microsoft.com/en-us/library/ms189794.aspx
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-08 : 04:05:32
[code]CASE WHEN DATEDIFF(hh,datefield1,datefield2) > value1
THEN 'delay'
...[/code]
Go to Top of Page
   

- Advertisement -