簡體   English   中英

指南或將FetchXML轉換為SQL查詢的任何工具

[英]Guide or any tool to convert FetchXML to SQL Query

下面是用於在Business Intelligent Development Studio中創建報表的FetchXML查詢。

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="incident">
    <attribute name="ticketnumber" />
    <attribute name="createdon" />
    <attribute name="statuscode" />
    <attribute name="incidentid" />
    <attribute name="caseorigincode" />
    <attribute name="new_statussla" />
    <attribute name="ownerid" />
    <attribute name="new_caseaging" />
    <attribute name="casetypecode" />
    <order attribute="ticketnumber" descending="false" />
    <filter type="and">
<condition attribute="createdon" operator="on-or-after" value="@Startdate" />
    <condition attribute="createdon" operator="on-or-before" value="@Enddate" />
    <condition attribute="caseorigincode" operator="ne" value="3" />
</filter>
<link-entity name="systemuser" from="systemuserid" to="owninguser" visible="false" link-type="outer" alias="a_cf39b8fda77b421483a1af5e511c39ca">
  <attribute name="new_region" />
  <attribute name="businessunitid" />
</link-entity>
 </entity>
</fetch>

我確實將此查詢轉換為SQL查詢,如下所示。

SELECT a.ticketnumber, a.createdon, a.statuscode,
a.incidentid, a.caseorigincode, a.new_statussla,
a.ownerid, a.new_caseaging, a.casetypecode,
b.new_region, b.businessunitid
FROM FilteredIncident a, FilteredSystemUser b
WHERE a.ownerid = b.systemuserid
AND createdon >= @StartDate
AND creaedon <= @EndDate
AND caseorigincode != '3'

我的問題,我的SQL查詢正確嗎? 即使我可以執行它。

出於需要,我剛剛創建了這個。 在GitHub上免費獲取FetchXML to SQL Convertor

正在進行的工作,但會提供可用的輸出。 嘗試! https://github.com/abtevrythng/FetchXML-to-SQL

這是您的fetchXML生成的輸出:

SELECT incident.ticketnumber, incident.createdon, incident.statuscode, incident.incidentid, incident.caseorigincode, incident.new_statussla, incident.ownerid, incident.new_caseaging, incident.casetypecode, systemuser.new_region, systemuser.businessunitid 
FROM incident 
LEFT OUTER JOIN systemuser ON incident.systemuserid = systemuser.owninguser
WHERE incident.createdon TBD '@Startdate'  AND incident.createdon TBD '@Enddate'  AND incident.caseorigincode != '3'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM