2017-03-27 3 views
0

下記のようなXMLをFetch XMLに変換しようとするとすばらしいものですが、以下のエラーがあります。SQLをFetchXMLに変換するとエラーが発生しますか?

Error: Error occurred when parsing the SQL script: Unsupported statement type: DECLARE

DECLARE 
    @OrganisationId uniqueidentifier 

SELECT 
    cil.mm_topprioritystatus, 
    cil.mm_achievedcatalogproductName, 
    cil.mm_achievedcatalogproductstatus, 
    ci.mm_key 
FROM 
    mm_catalogitemtorganisationlinker cil 
INNER JOIN 
    mm_catalogitem ci on 
     ci.mm_catalogitemId = cil.mm_catalogitem  
where 
    mm_organisation = @OrganisationId 
    and ci.mm_key in (
     'LEVEL1', 
     'LEVEL2', 
     'LEVEL3', 
     'LEVEL4' 
    ) 

上記のfetchXMLバージョンのために教えてください。あなたは、コードによって{organizationid}プレースホルダを交換する必要がもちろん

<fetch> 
    <entity name='mm_catalogitemtorganisationlinker' > 
    <attribute name='mm_topprioritystatus' /> 
    <attribute name='mm_achievedcatalogproductName' /> 
    <attribute name='mm_achievedcatalogproductstatus' /> 
    <filter> 
     <condition attribute='mm_organisation' operator='eq' value='{organizationid}' /> 
    </filter> 
    <link-entity name='mm_catalogitem' from='mm_catalogitemid' to='mm_catalogitem' link-type='inner' alias='ci' > 
     <attribute name='mm_key' /> 
     <filter> 
     <condition attribute='mm_key' operator='in' > 
      <value>LEVEL1</value> 
      <value>LEVEL2</value> 
      <value>LEVEL3</value> 
      <value>LEVEL4</value> 
     </condition> 
     </filter> 
    </link-entity> 
    </entity> 
</fetch> 

答えて

2

これは、1つの可能な解決策です。

関連する問題