Friday, January 29, 2010

Fetch or Retrieve?

Fetch or Retrieve?

The million dollars question what is better using fetch or RetrieveMultiple...

RetrieveMultiple faster than the Fetch method Retrieve doesn’t have to parse the query.

My tip:

Work direcly with CRM DB for Queries and update.

Important:
Use “nolock” for select command.
in this case database doesn’t lock the table
Use “rowlock” to update table lock only the specific record.

Example for select command:

Select firstname, lastname from contact with (nolock)

Example for update command:

Update incidentextensionbase WITH(rowlock) set new_firstname = ‘aaa’ where incidentid = ‘{fdkjdf98438e9w8euew987}

Enjoy,
Rami Heleg