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
 General SQL Server Forums
 New to SQL Server Programming
 date syntax

Author  Topic 

Trininole
Yak Posting Veteran

83 Posts

Posted - 2011-07-15 : 09:32:48
what is the syntax for displaying a date for example "displaydate" for at least 60 days?

Roger DeFour

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-07-15 : 09:44:59
SELECT *
FROM dbo.Table1
WHERE DisplayDate >= DATEADD(DAY, -60, GETDATE())



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

Trininole
Yak Posting Veteran

83 Posts

Posted - 2011-07-15 : 09:51:50
what syntax i would use to seek the display date for 60 days or more for any given date?

Roger DeFour
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-07-15 : 09:55:02
"60 days or more" of what?
Do you mean within 60 days of a ny given date?

select * from dbo.table1 where displaydate between dateadd(day, -60, @Mydate) and dateadd(day, 60, @mydate)



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

chetankdave
Starting Member

1 Post

Posted - 2011-07-15 : 16:39:06
I Have Table which have field called total_min (decimal) and total_hours(datetime) i have total_min data i want to add total_min to total_hours but in time format how can i do this kindly suggest Query

Chetan Dave
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-07-19 : 05:31:00
select dateadd(minute, total_min,total_hours) from table

Madhivanan

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

- Advertisement -