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 get the number of days from select query

Author  Topic 

reddymade
Posting Yak Master

165 Posts

Posted - 2005-12-21 : 17:00:49
I want the number of days using now(todays date) - ctr_recv_dt

table name: mytable

select getdate - ctr_recv_dt as days from mytable

Can you please tell me how to get the days.

Thank you.

CLages
Posting Yak Master

116 Posts

Posted - 2005-12-21 : 19:17:29
SELECT DATEDIFF(day, pubdate, getdate()) AS no_of_days

Clages
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-12-22 : 02:23:11
select DateDiff(day,ctr_recv_dt,Getdate()) as days from mytable


Madhivanan

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

- Advertisement -