General SQL: Difference between revisions

From Sage CRM Knowledge Base
Created page with " To get the reference id via SQL you run the code as follows: Declare @id nvarchar(128) DECLARE @return_value int execute @return_value = [eware_default_values] 'Case..."
 
No edit summary
Line 6: Line 6:
   execute @return_value = [eware_default_values] 'Cases', 'Case_CaseId', 'Case_ReferenceId', 00, @default_value = @id output  
   execute @return_value = [eware_default_values] 'Cases', 'Case_CaseId', 'Case_ReferenceId', 00, @default_value = @id output  
   select id = @id
   select id = @id
to run this code in ASP you would have to create the case record using "CreateRecord" and then update the case_referenceid
  var _sp='Declare @id nvarchar(128) '+
        'DECLARE @return_value int  '+
  'execute @return_value = [eware_default_values] \'Cases\', \'Case_CaseId\', \'Case_ReferenceId\', 00, @default_value = @id output  '+
  'select id = @id '+
  'update Cases '+
  'set Case_ReferenceId=@id '+
  'where Case_CaseId=1';
  var rec=CRM.ExecSQL(_sp);

Revision as of 14:39, 4 February 2013

To get the reference id via SQL you run the code as follows:

 Declare @id nvarchar(128) 
 DECLARE @return_value int 
 execute @return_value = [eware_default_values] 'Cases', 'Case_CaseId', 'Case_ReferenceId', 00, @default_value = @id output 
 select id = @id

to run this code in ASP you would have to create the case record using "CreateRecord" and then update the case_referenceid

 var _sp='Declare @id nvarchar(128) '+
       'DECLARE @return_value int  '+
 'execute @return_value = [eware_default_values] \'Cases\', \'Case_CaseId\', \'Case_ReferenceId\', 00, @default_value = @id output  '+
 'select id = @id '+
 'update Cases '+
 'set Case_ReferenceId=@id '+
 'where Case_CaseId=1';
 var rec=CRM.ExecSQL(_sp);