Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

how to select all fieldsin a soql query

// This is the object for which we required data.
Map<String, Schema.SObjectField> fieldMap = Opportunity.sObjectType.getDescribe().fields.getMap();
  
// Get all of the fields on the object
Set<String> fieldNames = fieldMap.keySet();
 
// Build a Dynamic Query String.
List<Opportunity> opps = Database.query('select ' + string.join(fieldNames, ',') + ' from Opportunity');
Source by www.brcline.com #
 
PREVIOUS NEXT
Tagged: #select #fieldsin #soql #query
ADD COMMENT
Topic
Name
1+3 =