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
 Transact-SQL (2000)
 please suggest me the solution for date difference

Author  Topic 

dasu
Posting Yak Master

104 Posts

Posted - 2004-10-16 : 02:06:29

THIS WILL GIVE NO OF DAYS DIFFERENCE
BUT I WANT DATE DIFFERENCE
QUERRY I MENTIONED BELLOW
USE pubs
GO
SELECT DATEDIFF(DAYS , pubdate, getdate()) AS no_of_days
FROM titles
GO

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2004-10-16 : 02:54:23
what do you mean by 'Date Difference'? What measurement do you want to use to quantify the difference?

Looks like you are on the right track, just lookup the other options for datediff params

EDIT: That's 1000!

Corey
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-10-16 : 09:07:51
maybe

select getdate() - pubdtae from titles

that will give the difference as a datetime.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

dasu
Posting Yak Master

104 Posts

Posted - 2004-10-19 : 07:04:10
thanks
i got the solution
i want to share this to u all

SET @intMxValDays=90
--finding the date before specific period
SET @dtValDt=DATEADD(day, -@intMxValDays,@dtLogicalDt)
Go to Top of Page
   

- Advertisement -