Search
 
SCRIPT & CODE EXAMPLE
 

SQL

select all fields in soql

SELECT FIELDS(ALL) FROM Account
Comment

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');
Comment

soql- select all fields

Select FIELDS(CUSTOM) FROM Account LIMIT 200
select fields(standard) from account limit 200
select fields(all) from account limit 200
Comment

how to select all fieldsin a soql query

Id rId = 'SomeValidSFDCId';
 
DescribeSObjectResult describeResult = rId.getSObjectType().getDescribe();      
Map<String, Schema.SObjectField> fieldMap = describeResult.fields.getMap();
  
// Get all of the fields on the object
Set<String> fieldNames = fieldMap.keySet();
 
// Build a Dynamic Query String.
String soqlQuery = ' SELECT ' + string.join (fieldName, ',') + ' FROM ' + describeResult.getName() + ' Where Id =: rId';
 
// Need to return a generic list of sObject because we don't necessarily know exactly what the object is.
List<sObject> record = Database.query(soqlQuery);
Comment

PREVIOUS NEXT
Code Example
Sql :: create database mysql utf8 
Sql :: oracle sql drop sequence 
Sql :: remove mysql from centos 7 
Sql :: how to get yesterday date in sql 
Sql :: sql ignore accents 
Sql :: drop stored procedure mysql 
Sql :: check connections to database postgres 
Sql :: check database name oracle 
Sql :: alter table column change data type to text mysql 
Sql :: select duplicates in sql 
Sql :: oracle enable job 
Sql :: get all tables postgres 
Sql :: find largest table in mysql database 
Sql :: mac xampp mysql not starting 
Sql :: while loop sql 
Sql :: delete mysql from mac 
Sql :: RENAME table pl sql 
Sql :: oracle search text in all packages 
Sql :: how to unlock table in mysql 
Sql :: sql server get timezone 
Sql :: get current month mysql 
Sql :: postgresql search all tables for column name 
Sql :: sqlite connection string 
Sql :: netstat -tln mysql 
Sql :: import dump mysql 
Sql :: mysql get yesterday 
Sql :: add mysql to path 
Sql :: mysql id reset 
Sql :: psql count where not null 
Sql :: copy from folders in sql server 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =