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
 URGENT !! ODBC CONNECTION

Author  Topic 

Neil123
Starting Member

1 Post

Posted - 2013-07-28 : 08:59:26
Hi All,

I am trying to pull the data from Salesforce using sql server.
I would like to pull all the data where CreatedDate= GETDATE()-1 but it throws me an error.

Is there any other way to import only yesterdays data? This should be an automatic process. this should be scheduled and run everyday.


Here is my query:
Select * into Contacts
From (openquery,SALESFORCE 'Select Id From Contacts Where CreatedDate=GETDATE()-1)'

I can run other queries and import. but it throws me an error whenever i filter with date.

I appreciate your help.
Thanks in advance

Cheers,
Neil

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2013-07-28 : 10:07:21
where createdDate>=dateadd(day,datediff(day,0,getdate())-1,0) and createdDate<dateadd(day,datediff(day,0,getdate()),0)

More examples at http://beyondrelational.com/modules/2/blogs/70/posts/10899/understanding-datetime-column-part-iii.aspx


Madhivanan

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

- Advertisement -