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 2005 Forums
 SSIS and Import/Export (2005)
 DataReader Source Problem

Author  Topic 

krabople
Starting Member

17 Posts

Posted - 2008-08-20 : 04:07:22
Hi, I have an integration services project where I am looking to import data from a MySQL database into a SQL Server database. In the SQL in the DataReader Source box I have the following criteria as the WHERE clause:

WHERE issuedate>=curdate()-365

I expected this to return data from the last 365 days. However, when it runs it only returns data since 01/05/08. I have tried substituting ">=curdate()-365" for the correct date to check that it is not an issue with the data and it works ok. Any idea where I'm going wrong? Is this the correct syntax for MySQL?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-20 : 05:09:44
try using

WHERE issuedate>=dateadd(d,-365,curdate())
Go to Top of Page

krabople
Starting Member

17 Posts

Posted - 2008-08-20 : 05:24:19
Thanks, I tried that though and it comes up with an error, I don't think MySQL recognises dateadd as a valid function
Go to Top of Page

krabople
Starting Member

17 Posts

Posted - 2008-08-20 : 05:47:21
It's ok I've found it now, the correct syntax was:

WHERE issuedate>=ADDDATE(curdate(), -365)

Thanks for your input though.
Go to Top of Page
   

- Advertisement -