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)
 Query Problem: Using int field to adjust datetime

Author  Topic 

cjflanna
Starting Member

2 Posts

Posted - 2009-11-09 : 11:29:54
I'm working on some calendar functions in asp.net. I'm trying to build a query that basically says this:

SELECT * FROM tblEvents WHERE start date + duration > beginning of month

this way I don't pull any data that shouldn't be displayed this month. I have most of this figured out, but I'm not sure how to add to a date field the value of int field. I know my syntax is wrong here, but would it be something like this (intDuration and dtmStartDate are both columns in the table)?

"SELECT * FROM tblEvents WHERE AddWeeks(dtmStartDate, intDuration) > '" & curMonthDate & "'"

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-11-09 : 11:45:18
may be this is what you want

"SELECT * FROM tblEvents WHERE DATEADD(wk, intDuration,dtmStartDate) > '" & curMonthDate & "'"
Go to Top of Page

cjflanna
Starting Member

2 Posts

Posted - 2009-11-09 : 11:48:29
I'll give it a shot and report back, thanks!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-11-09 : 12:08:18
ok..good luck!
Go to Top of Page
   

- Advertisement -