الأربعاء، 13 أغسطس 2014

Using CURSOR in SQL

Declare @AppId as varchar(50)
Declare @InvoiceNo as varchar(50)
declare @DueDate as datetime

DECLARE AppCURS CURSOR FOR

select cit_applicationno,new_InvoiceNo,cit_DueDate from ZmZm_MSCRM.dbo.cit_application where statuscode=912660015

OPEN AppCURS
fetch next from AppCURS into @AppId,@InvoiceNo,@DueDate
WHILE @@FETCH_STATUS = 0
BEGIN  
update AX2012R2_DB.dbo.PURCHTABLE 
set 
CRMINVIOCENUM=@InvoiceNo,
ACCOUNTINGDATE=@DueDate,
ISINVOICERECEIVED=1
where VENDORREF=@AppId

fetch next from AppCURS into @AppId,@InvoiceNo,@DueDate
END   

CLOSE AppCURS   
DEALLOCATE AppCURS

الاثنين، 11 أغسطس 2014

SQL Timeout solutions in Dynamics CRM 2011

Mostly this kind of problems could come from Plugins, if there are any plugins executed on that action.

Increase the default timeout

Registry on CRM applicationserver(s)
  1. Open CRM Web Server(where CRM is installed)
  2. Open regedit (start – > write ( regedit) ) and press ok
  3. Go to HKEY_LOCAL_MACHINESOFTWAREMicrosoftMSCRM
  4. Add DWORD name OLEDBTimeout with value 86400 ( 24 hours) select decimal
  5. Add DWORD name ExtendedTimeout with value 1000000. The maximum value can be 2,147,483,647 and the default value is 30 seconds
These changes in register should fix the SQL timeout.