How do you use SQL statements to query this information in CRM?
Querying entity information:
--Querying entity information, Entity name: Account
SELECT * from metadataschema.entity where name= ' account '
Query Form information:
--Query form information, Objecttypecode: Entity's code
SELECT * from systemform where Objecttypecode = 1
Query View information:
--Query View information, Returnedtypecode: Entity's code
SELECT * from savedquerybase where Returnedtypecode = 1
Query Field information:
--Query field information
With attr as (
SELECT * FROM Metadataschema.attribute as a
where A.entityid in (select EntityId from metadataschema.entity
where name = ' New_member ') and A.iscustomfield = 1
)
Select A.attributeid,a.name,label. Label,ty. Description,
(select top 1 name from metadataschema.entity where EntityId in (
Select Ship. Referencedentityid from Metadataschema.relationship as ship
where ship. Referencingattributeid = A.attributeid)) as ' Lookname '
From attr as a inner join Metadataschema.localizedlabel as label
On a.attributeid = Label.objectid inner join metadataschema.attributetypes as Ty
On a.attributetypeid = Ty. Attributetypeid
where label.objectcolumnname = ' DisplayName ' and A.validforcreateapi = 1
Query Relationship information:
SELECT * from Metadataschema.relationship where Referencingentityid in
(select top 1 entityid from metadataschema.entity where name = ' New_store ')
Crmsql Statement Query Entity Form entity field Relationship information