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 2008 Forums
 Transact-SQL (2008)
 How to get number of days using getdate

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2011-04-28 : 12:02:30
I have variable which has date:
Declare @FutureAlertDate as datetime

Set @FutureAlertDate = '2012-04-26 00:00:00.000'

Now want to get the number of days from today(getdate()) till this day: @FutureAlertDate

Thank you very much for the helpful info.

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2011-04-28 : 12:05:01
DATEDIFF

http://msdn.microsoft.com/en-us/library/ms189794.aspx
Go to Top of Page
   

- Advertisement -