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 2000 Forums
 SQL Server Development (2000)
 How to make the difference an Absolute Value?

Author  Topic 

jonasdavedomingo
Starting Member

33 Posts

Posted - 2004-12-05 : 06:18:15
Lets say i want to get the difference of two dates:

DATEDIFF(dd, system_date, st_TargetFinishDate)


I want to make the difference an absolute value where it will become positive if the difference is negative.
How will i do that?

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2004-12-05 : 06:39:54
Hi

Use the ABS function.

ABS( DATEDIFF(dd, system_date, st_TargetFinishDate) )

There is more detail in BOL if you look up ABS.

Hope that helps



Damian
Go to Top of Page

jonasdavedomingo
Starting Member

33 Posts

Posted - 2004-12-05 : 10:48:56
quote:
Originally posted by Merkin

Hi

Use the ABS function.

ABS( DATEDIFF(dd, system_date, st_TargetFinishDate) )

There is more detail in BOL if you look up ABS.

Hope that helps



Damian


it works. thanks!!!
Go to Top of Page
   

- Advertisement -