用SQL语句导出Dynamics 365/CRM的表结构

with attr as
(
select b.Name as EntityName, b.originalLocalizedName as EntityNote
,a.PhysicalName,a.AttributeId,a.IsCustomField,a.Length,a.IsNullable
,a.AttributeTypeId,a.validforcreateapi
from MetadataSchema.Attribute as a
join MetadataSchema.Entity as b ON
a.IsCustomField = 1
and b.IsCustomEntity=1
and a.EntityId=b.entityid
–and b.Name=‘new_EntityType’
)
select a.EntityName as TableName,a.EntityNote as TableDesc,PhysicalName as ColumnName,
label.Label as ColumnDesc,ty.Description as ‘Type’,
(select top 1 name from MetadataSchema.Entity
where EntityId in
( select ship.ReferencedEntityId
from MetadataSchema.Relationship as ship
where ship.ReferencingAttributeId = a.AttributeId)
) as ‘Default’
,a.IsCustomField,a.Length
,NullAble=CASE WHEN a.IsNullable=1 THEN N’√’ELSE N’’ END
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

ORDER BY entityname,ColumnName

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值