SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 URGENT !! ODBC CONNECTION
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Neil123
Starting Member

1 Posts

Posted - 07/28/2013 :  08:59:26  Show Profile  Reply with Quote
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

India
22713 Posts

Posted - 07/28/2013 :  10:07:21  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000