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.
| Author |
Topic |
|
Todd2006
Starting Member
18 Posts |
Posted - 2009-02-24 : 21:32:58
|
| Hello,Here is my querySo if the date in reg_date is 02/23/2009 it wont show the records when the date is 02/24/2009 but I want to display the record till 02/25/2009.So I want to display the record 2 days after the Reg_Date[CODE]strselect = "SELECT Distinct State from Registration where CDate(Reg_Date) > dateadd("day",-2,Date())"[/CODE]but it doesnt work is the dateadd function rightCan someone tell me what change in the query I have to make.todd |
|
|
ucal
Yak Posting Veteran
72 Posts |
Posted - 2009-02-24 : 21:44:37
|
| Try:SELECT Distinct State from Registration where CAST(Reg_Date AS DATETIME) > dateadd(DAY,-2,GETDATE()) |
 |
|
|
Todd2006
Starting Member
18 Posts |
Posted - 2009-02-24 : 21:53:04
|
| gives an error like this[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'CAST(Reg_Date AS DATETIME) > dateadd(DAY,-2,GETDATE())'. |
 |
|
|
ucal
Yak Posting Veteran
72 Posts |
Posted - 2009-02-24 : 21:56:55
|
| This is SQL Server 2005 forum , you may consider posting you questions in MS ACCESS forum |
 |
|
|
|
|
|