function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LuciferLucifer 

Help on soql query

I use an ETL tool that dumps all cases, contacts, users in salesforce to a sql database. Presently what im doing is I have the job saved in my ETL tool with the query Select * from cases and every time I run the job I set the condition to delete the existing table and create new table so there wont be duplicates whenever I run the job. Now I was asked to create a job that runs every night. So I dont want to use the query select * from cases as it would take atleast 5 hours to complete the job.
 
So I was looking for a customised query which should be this way.
 
select * from cases where created or updated time >= last dump date
 
 
So that way my job just fetches the updated and the newly created cases every day sparing the rest. 
 
 
Can I get it in some salesforce proper SOQL syntax please... That way I can query it in the ETL tool instead of using select * from cases every time I try to dump..
Best Answer chosen by Admin (Salesforce Developers) 
Cory CowgillCory Cowgill

There is a method called "GetUpdated" in the API. You will want to use that:

http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_calls_getupdated.htm#topic-title

 

If you want to go pure SOQL route you can do this:

 

List<Case> cases = [Select Id from Case where LastModifiedDate = TODAY]

 

or

 

DateTime date = DateTime.newInstance();

List<Case> cases = [Select Id from Case where LastModifiedDate >=: dateParam];

 

SOQL DateTime Queries Documentation:

http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_calls_soql_select_dateformats.htm

All Answers

Cory CowgillCory Cowgill

There is a method called "GetUpdated" in the API. You will want to use that:

http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_calls_getupdated.htm#topic-title

 

If you want to go pure SOQL route you can do this:

 

List<Case> cases = [Select Id from Case where LastModifiedDate = TODAY]

 

or

 

DateTime date = DateTime.newInstance();

List<Case> cases = [Select Id from Case where LastModifiedDate >=: dateParam];

 

SOQL DateTime Queries Documentation:

http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_calls_soql_select_dateformats.htm

This was selected as the best answer
LuciferLucifer

Thank you. Thats helpful. Will try to work on it.