Reading the DAX query plan of a trace against a query on a Tabular model

Hi,
I'm monitoring a Tabular model queried by an Excel workbook. Inside SQL Profiler I've choosen as events the VertiPaq SE Query End, the Query End and the DAX Query Plan. But this last event isn't more readable.
How can I read the info collected in the DAX Query Plan in a simple manner?
Thanks

It is fairly complex to read the DAX Query Plan. I don't think there are currently tools that make it easier to read. (Watch the DAX Studio project on codeplex as they may include tools for this in the future.) I would recommend you review the Tabular
Performance Guide which has a good explanation of the DAX Query Plan:
http://aka.ms/ASTabPerf2012
http://artisconsulting.com/Blogs/GregGalloway

Similar Messages

  • Bad query plan for self-referencing CTE view query and variable in WHERE clause. Is there way out or this is SQL Server defect?

    Please help. Thank you for your time and expertise.
    Prerequisites: sql query needs to be a view. Real view is more than recursion. It computes location path,  is used in JOINs and returns this path.
    Problem: no matter what I tried, sql server does not produce 'index seek' when using variable but does with literal.
    See full reproduction code below.
    I expect that query SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = @lcID will seek UNIQUE index but it does not.
    I tried these:
    1. Changing UX and/or PK to be CLUSTERED.
    2. query OPTION(RECOMPILE)
    3. FORCESEEK on view
    4. SQL Server 2012/2014
    5. Wrap it into function and CROSS APPLY. On large outer number of rows this just dies, no solution
    but to no avail. This smells like a bug in SQL Server. I am seeking your confirmation.
    I am thinking it is a bug as variable value is high-cardinality, 1, and query is against unique key. This must produce single seek, depending if clustered or nonclustred index is unique
    Thanks
    Vladimir
    use tempdb
    BEGIN TRAN
    -- setup definition
    CREATE TABLE dbo.LocationHierarchy(
    lcID int NOT NULL ,
    lcHID hierarchyid NOT NULL,
    lcCode nvarchar(25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    lcHIDParent AS lcHID.GetAncestor(1) PERSISTED,
    CONSTRAINT PK_LocationHierarchy_lcID PRIMARY KEY NONCLUSTERED (lcID ASC),
    CONSTRAINT UX_LocationHierarchy_pltID_lcHID UNIQUE CLUSTERED (lcHID ASC)
    -- add some data
    INSERT INTO dbo.LocationHierarchy
    VALUES
    (1, '/', 'A')
    ,(2, '/1/', 'B')
    ,(3, '/1/1/', 'C')
    ,(4, '/1/1/1/', 'D')
    --DROP VIEW dbo.vwLocationCodes
    GO
    CREATE VIEW dbo.vwLocationCodes
    AS
    WITH ru AS
    SELECT
    lh.lcID
    ,lh.lcCode
    ,lh.lcHID
    ,CAST('/' + lh.lcCode + '/' as varchar(8000)) as LocationPath
    -- to support recursion
    ,lh.lcHIDParent
    FROM dbo.LocationHierarchy lh
    UNION ALL
    SELECT
    ru.lcID
    ,ru.lcCode
    ,ru.lcHID
    ,CAST('/' + lh.lcCode + ru.LocationPath as varchar(8000)) as LocationPath
    ,lh.lcHIDParent
    FROM dbo.LocationHierarchy lh
    JOIN ru ON ru.lcHIDParent = lh.lcHID
    SELECT
    lh.lcID
    ,lh.lcCode
    ,lh.LocationPath
    ,lh.lcHID
    FROM ru lh
    WHERE lh.lcHIDParent IS NULL
    GO
    -- get data via view
    SELECT
    CONCAT(SPACE(l.lcHID.GetLevel() * 4), lcCode) as LocationIndented
    FROM dbo.vwLocationCodes l
    ORDER BY lcHID
    GO
    SET SHOWPLAN_XML ON
    GO
    DECLARE @lcID int = 2
    -- I believe this produces bad plan and is defect in SQL Server optimizer.
    -- variable value cardinality is 1 and SQL Server should know that. Optiomal plan is to do index seek with key lookup.
    -- This does not happen.
    SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = @lcID -- bad plan
    -- this is a plan I expect.
    SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = 2 -- good plan
    -- I reviewed these but I need a view here, can't be SP
    -- http://sqlblogcasts.com/blogs/tonyrogerson/archive/2008/05/17/non-recursive-common-table-expressions-performance-sucks-1-cte-self-join-cte-sub-query-inline-expansion.aspx
    -- http://social.msdn.microsoft.com/Forums/sqlserver/en-US/22d2d580-0ff8-4a9b-b0d0-e6a8345062df/issue-with-select-using-a-recursive-cte-and-parameterizing-the-query?forum=transactsql
    GO
    SET SHOWPLAN_XML OFF
    GO
    ROLLBACK
    Vladimir Moldovanenko

    Here is more... note that I am creating table Items and these can be in Locations.
    I am trying LEFT JOIN and OUTER APLLY to 'bend' query into NESTED LOOP and SEEK. There has to be nested loop, 2 rows against 4. But SQL Server fails to generate optimal plan with SEEK. Even RECOMPILE does not help
    use tempdb
    BEGIN TRAN
    -- setup definition
    CREATE TABLE dbo.LocationHierarchy(
    lcID int NOT NULL ,
    lcHID hierarchyid NOT NULL,
    lcCode nvarchar(25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    lcHIDParent AS lcHID.GetAncestor(1) PERSISTED,
    CONSTRAINT PK_LocationHierarchy_lcID PRIMARY KEY NONCLUSTERED (lcID ASC),
    CONSTRAINT UX_LocationHierarchy_pltID_lcHID UNIQUE CLUSTERED (lcHID ASC)
    -- add some data
    INSERT INTO dbo.LocationHierarchy
    VALUES
    (1, '/', 'A')
    ,(2, '/1/', 'B')
    ,(3, '/1/1/', 'C')
    ,(4, '/1/1/1/', 'D')
    --DROP VIEW dbo.vwLocationCodes
    GO
    --DECLARE @Count int = 10;
    --WITH L0 AS (SELECT N FROM (VALUES(1),(1),(1),(1),(1),(1),(1),(1),(1),(1)) N (N))-- 10 rows
    --,L1 AS (SELECT n1.N FROM L0 n1 CROSS JOIN L0 n2) -- 100 rows
    --,L2 AS (SELECT n1.N FROM L1 n1 CROSS JOIN L1 n2) -- 10,000 rows
    --,L3 AS (SELECT n1.N FROM L2 n1 CROSS JOIN L2 n2) -- 100,000,000 rows
    --,x AS
    -- SELECT TOP (ISNULL(@Count, 0))
    -- ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) as Number
    -- FROM L3 n1
    --SELECT Number as itmID, NTILE(4)OVER(ORDER BY Number) as lcID
    --INTO dbo.Items
    --FROM x
    ----ORDER BY n1.N
    --ALTER TABLE dbo.Items ALTER COLUMN itmID INT NOT NULL
    --ALTER TABLE dbo.Items ADD CONSTRAINT PK PRIMARY KEY CLUSTERED (itmID)
    CREATE TABLE dbo.Items (itmID int NOT NULL PRIMARY KEY, lcID int NOT NULL)
    INSERT INTO dbo.items
    VALUES(1, 1)
    ,(2, 3)
    GO
    CREATE VIEW dbo.vwLocationCodes
    AS
    WITH ru AS
    SELECT
    lh.lcID
    ,lh.lcCode
    ,lh.lcHID
    ,CAST('/' + lh.lcCode + '/' as varchar(8000)) as LocationPath
    -- to support recursion
    ,lh.lcHIDParent
    FROM dbo.LocationHierarchy lh
    UNION ALL
    SELECT
    ru.lcID
    ,ru.lcCode
    ,ru.lcHID
    ,CAST('/' + lh.lcCode + ru.LocationPath as varchar(8000)) as LocationPath
    ,lh.lcHIDParent
    FROM dbo.LocationHierarchy lh
    JOIN ru ON ru.lcHIDParent = lh.lcHID
    SELECT
    lh.lcID
    ,lh.lcCode
    ,lh.LocationPath
    ,lh.lcHID
    FROM ru lh
    WHERE lh.lcHIDParent IS NULL
    GO
    -- get data via view
    SELECT
    CONCAT(SPACE(l.lcHID.GetLevel() * 4), lcCode) as LocationIndented
    FROM dbo.vwLocationCodes l
    ORDER BY lcHID
    GO
    --SET SHOWPLAN_XML ON
    GO
    DECLARE @lcID int = 2
    -- I believe this produces bad plan and is defect in SQL Server optimizer.
    -- variable value cardinality is 1 and SQL Server should know that. Optiomal plan is to do index seek with key lookup.
    -- This does not happen.
    SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = @lcID-- OPTION(RECOMPILE) -- bad plan
    -- this is a plan I expect.
    SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = 2 -- good plan
    SELECT *
    FROM dbo.Items itm
    LEFT JOIN dbo.vwLocationCodes l ON l.lcID = itm.lcID
    OPTION(RECOMPILE)
    SELECT *
    FROM dbo.Items itm
    OUTER APPLY
    SELECT *
    FROM dbo.vwLocationCodes l
    WHERE l.lcID = itm.lcID
    ) l
    -- I reviewed these but I need a view here, can't be SP
    -- http://sqlblogcasts.com/blogs/tonyrogerson/archive/2008/05/17/non-recursive-common-table-expressions-performance-sucks-1-cte-self-join-cte-sub-query-inline-expansion.aspx
    -- http://social.msdn.microsoft.com/Forums/sqlserver/en-US/22d2d580-0ff8-4a9b-b0d0-e6a8345062df/issue-with-select-using-a-recursive-cte-and-parameterizing-the-query?forum=transactsql
    GO
    --SET SHOWPLAN_XML OFF
    GO
    ROLLBACK
    Vladimir Moldovanenko

  • Actual Query Plan not running

    I am using SQL Server 2012 (11.0.5058.0) and I am trying to learn Execution Plan Basics.  One of the tasks is to run the "Actual Query Plan" by CTRL+M.  When I try this nothing happens.  I can do the "Display Estimated
    Query Plan" and it works.  Why can't I do the Actual Query Plan?

    Hi,
    To display Actual Query Plan, you have to execute the query. CTRL+M merely toggles to display Actual Query Plan or not.
    See:
    Display an Actual Execution Plan
    Hope this helps,
    ~ J.

  • SQL 2012 SP1 - How to determine a query that causes Error 8623 in SQL Log: The query processor ran out of internal resources and could not produce a query plan. This is a rare event...

    We are getting multiple 8623 Errors in SQL Log while running Vendor's software.
    How can you catch which Query causes the error?
    I tried to catch it using SQL Profiler Trace but it doesn't show which Query/Sp is the one causing an error. 
    I also tried to use Extended Event session to catch it, but it doesn't create any output either.
    Error:
    The query processor ran out of internal resources and could not produce a query plan. This is a rare event and only expected for extremely complex queries or queries that
    reference a very large number of tables or partitions. Please simplify the query. If you believe you have received this message in error, contact Customer Support Services for more information.
    Extended Event Session that I used;
    CREATE EVENT SESSION
        overly_complex_queries
    ON SERVER
    ADD EVENT sqlserver.error_reported
        ACTION (sqlserver.sql_text, sqlserver.tsql_stack, sqlserver.database_id, sqlserver.username)
        WHERE ([severity] = 16
    AND [error_number] = 8623)
    ADD TARGET package0.asynchronous_file_target
    (SET filename = 'E:\SQLServer2012\MSSQL11.MSSQLSERVER\MSSQL\Log\XE\overly_complex_queries.xel' ,
        metadatafile = 'E:\SQLServer2012\MSSQL11.MSSQLSERVER\MSSQL\Log\XE\overly_complex_queries.xem',
        max_file_size = 10,
        max_rollover_files = 5)
    WITH (MAX_DISPATCH_LATENCY = 5SECONDS)
    GO
    -- Start the session
    ALTER EVENT SESSION overly_complex_queries
        ON SERVER STATE = START
    GO
    It creates only .xel file, but not .xem
    Any help/advice is greatly appreciated

    Hi VK_DBA,
    According to your error message, about which query statement may fail with error message 8623, as other post, you can use trace flag 4102 & 4118 for overcoming this error. Another way is looking for queries with very long IN lists, a large number of
    UNIONs, or a large number of nested sub-queries. These are the most common causes of this particular error message.
    The error 8623 occurs when attempting to select records through a query with a large number of entries in the "IN" clause (> 10,000). For avoiding this error, I suggest that you could apply the latest Cumulative Updates media for SQL Server 2012 Service
    Pack 1, then simplify the query. You may try divide and conquer approach to get part of the query working (as temp table) and then add extra joins / conditions. Or You could try to run the query using the hint option (force order), option (hash join), option
    (merge join) with a plan guide.
    For more information about error 8623, you can review the following article.
    http://blogs.technet.com/b/mdegre/archive/2012/03/13/8623-the-query-processor-ran-out-of-internal-resources-and-could-not-produce-a-query-plan.aspx
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Can users see the query plan of a SQL query in Oracle?

    Hi,
    I wonder for a given sql query, after the system optimization, can I see the query plan in oracle? If yes, how to do that? thank you.
    Xing

    You can use explain plan in SQLPlus
    SQL>  explain plan for select * from user_tables;
    Explained.
    Elapsed: 00:00:01.63
    SQL> select * from table(dbms_xplan.display());
    PLAN_TABLE_OUTPUT
    Plan hash value: 806004009
    | Id  | Operation                       | Name     | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                |          |  2014 |  1123K|   507   (6)| 00:00:07 |
    |*  1 |  HASH JOIN RIGHT OUTER          |          |  2014 |  1123K|   507   (6)| 00:00:07 |
    |   2 |   TABLE ACCESS FULL             | SEG$     |  4809 |   206K|    34   (3)| 00:00:01 |
    |*  3 |   HASH JOIN RIGHT OUTER         |          |  1697 |   873K|   472   (6)| 00:00:06 |
    |   4 |    TABLE ACCESS FULL            | USER$    |    74 |  1036 |     3   (0)| 00:00:01 |
    |*  5 |    HASH JOIN OUTER              |          |  1697 |   850K|   468   (6)| 00:00:06 |
    |   6 |     NESTED LOOPS OUTER          |          |  1697 |   836K|   315   (6)| 00:00:04 |
    |*  7 |      HASH JOIN                  |          |  1697 |   787K|   226   (8)| 00:00:03 |
    |   8 |       TABLE ACCESS FULL         | TS$      |    13 |   221 |     5   (0)| 00:00:01 |
    |   9 |       NESTED LOOPS              |          |  1697 |   759K|   221   (8)| 00:00:03 |
    |  10 |        MERGE JOIN CARTESIAN     |          |  1697 |   599K|   162  (10)| 00:00:02 |
    |* 11 |         HASH JOIN               |          |     1 |   326 |     1 (100)| 00:00:01 |
    |* 12 |          FIXED TABLE FULL       | X$KSPPI  |     1 |    55 |     0   (0)| 00:00:01 |
    |  13 |          FIXED TABLE FULL       | X$KSPPCV |   100 | 27100 |     0   (0)| 00:00:01 |
    |  14 |         BUFFER SORT             |          |  1697 | 61092 |   162  (10)| 00:00:02 |
    |* 15 |          TABLE ACCESS FULL      | OBJ$     |  1697 | 61092 |   161  (10)| 00:00:02 |
    |* 16 |        TABLE ACCESS CLUSTER     | TAB$     |     1 |    96 |     1   (0)| 00:00:01 |
    |* 17 |         INDEX UNIQUE SCAN       | I_OBJ#   |     1 |       |     0   (0)| 00:00:01 |
    |  18 |      TABLE ACCESS BY INDEX ROWID| OBJ$     |     1 |    30 |     1   (0)| 00:00:01 |
    |* 19 |       INDEX UNIQUE SCAN         | I_OBJ1   |     1 |       |     0   (0)| 00:00:01 |
    |  20 |     TABLE ACCESS FULL           | OBJ$     | 52728 |   411K|   151   (4)| 00:00:02 |
    Predicate Information (identified by operation id):
       1 - access("T"."FILE#"="S"."FILE#"(+) AND "T"."BLOCK#"="S"."BLOCK#"(+) AND
                  "T"."TS#"="S"."TS#"(+))
       3 - access("CX"."OWNER#"="CU"."USER#"(+))
       5 - access("T"."DATAOBJ#"="CX"."OBJ#"(+))
       7 - access("T"."TS#"="TS"."TS#")
      11 - access("KSPPI"."INDX"="KSPPCV"."INDX")
      12 - filter("KSPPI"."KSPPINM"='_dml_monitoring_enabled')
      15 - filter("O"."OWNER#"=USERENV('SCHEMAID') AND BITAND("O"."FLAGS",128)=0)
      16 - filter(BITAND("T"."PROPERTY",1)=0)
      17 - access("O"."OBJ#"="T"."OBJ#")
      19 - access("T"."BOBJ#"="CO"."OBJ#"(+))
    42 rows selected.
    Elapsed: 00:00:03.61
    SQL> If your plan table does not exist, execute the script $ORACLE_HOME/RDBMS/ADMIN/utlxplan.sql to create the table.

  • What is the best way to query planned orders or work orders for make items and identify the buy component that is short for supply and vice versa?

    What is the best way to query planned orders or work orders for make items and identify the buy component that is short for supply and vice versa?

    What is the best way to query planned orders or work orders for make items and identify the buy component that is short for supply and vice versa?

  • Performace and how to read the plan

    Hi all, i am having some problem with a query. i cannot really read the explain plan. here it is
    VIEW of "LOT" #4 (Cost=559,177 Card=35,277,895 bytes=30,868,158,125)
      UNION-ALL
         HASH JOIN (Cost=558,852 Card=34,981,759 bytes=9,794,892,520)
            TABLE ACCESS (FULL) of "ENT" #27 Optimizer=ANALYZED (Cost=13 Card=6,214 bytes=267,202)
            HASH JOIN (Cost=541,331 Card=34,981,759 bytes=8,290,676,883)
               TABLE ACCESS (FULL) of "SMASTER" #28 Optimizer=ANALYZED (Cost=573 Card=282,970 bytes=17,261,170)
               HASH JOIN (Cost=459,945 Card=34,981,759 bytes=6,156,789,584)
               INLIST ITERATOR
                   TABLE ACCESS (BY INDEX ROWID) of "INTERFACES" #29 Optimizer=ANALYZED (Cost=2 Card=5 bytes=100)
                       INDEX (RANGE SCAN) of "INTERFACES_INDX1" UNIQUE Optimizer=ANALYZED (Cost=1 Card=1 bytes=)
               HASH JOIN (Cost=457,468 Card=153,919,741 bytes=24,011,479,596)
               TABLE ACCESS (FULL) of "POS" #25 Optimizer=ANALYZED (Cost=1,819 Card=5,756,878 bytes=132,408,194)
               TABLE ACCESS (FULL) of "L_POS" #26 Optimizer=ANALYZED (Cost=179,932 Card=153,840,627 bytes=20,460,803,391)
      TABLE ACCESS (FULL) of "HOLD" #31 Optimizer=ANALYZED (Cost=325 Card=296,136 bytes=40,866,768)can somebody tell me what is happening. what steps gets executed first then next and next, etc? it looks like the cost is a lot and this is hurting the performance.
    i know tuning involved a lot such as stats, index use, # of rows, etc.
    what i am looking for here is how to read the plan, any idea what this is doing? please explain. also any recommendation to improve the plan base on the plan above. thanks

    A quick search in google for oracle reading explain plan
    Top hits are very nice writeups...
    http://www.akadia.com/services/ora_interpreting_explain_plan.html
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/ex_plan.htm
    vr,
    Sudhakar B.

  • SQL 2005 v9.0.2047 (SP1) - The query processor could not produce a query plan

    Hi Everyone:
    *Before* I actually call up Microsoft SQL Customer Support Services and ask them, I wanted to ping other people to see if you have ever ran into this exact error
    "Internal Query Processor Error: The query processor could not produce a query plan. For more information, contact Customer Support Services."
    I would have searched the forums myself, but at this moment in time, search is broken :(
    If anyone has run into this error before, what conditions would exist that this could happen?  That is, if I can sniff this out with suggestions from the community, I would be happy to do so. 
    It is an oddity because if I alter a couple subqueries in the where clause [ i.e., where tab.Col = (select val from tab2 where id='122') ]to not have subqueries [hand coded values], then the t-sql result is fine.  It's not as if subqueries are oddities... I've used them when appropriate.
    fwiw - Not a newbie t-sql guy.  ISV working almost daily with t-sql since MS SQL 2000.  I have never seen this message before...at least I don't recall ever seeing it.
    Thanks in advance for other suggested examination paths.

    This code also produces the error... the text is from an incident a while ago that I reported to microsoft.
    --I just found a way to break the query engine. Looks like the SQL Server team missed something. I was generating phony data for test cases, by the way.
    --Bad code:
    DECLARE @t_Asset TABLE
    (Asset_Id INT)
    INSERT INTO @t_Asset (Asset_Id) VALUES (1)
    INSERT INTO @t_Asset (Asset_Id) VALUES (2)
    INSERT INTO @t_Asset (Asset_Id) VALUES (3)
    DECLARE @Record_id INT
    ,@File_id NVARCHAR(MAX)
    ,@SKP_Cust_id NVARCHAR(MAX)
    ,@Unique_Barcode NVARCHAR(MAX)
    SELECT @Record_Id = (SELECT TOP 1 Asset_Id FROM @t_Asset)
    , @file_id = (SELECT LEFT(REPLACE(CAST(NEWID() AS NVARCHAR(50)), '-', ''), 10))
    ,@Unique_Barcode=(SELECT LEFT(REPLACE(CAST(NEWID() AS NVARCHAR(50)), '-', ''), 15))
    go
    --Msg 8624, Level 16, State 116, Line 12
    --Internal Query Processor Error: The query processor could not produce a query plan. For more information, contact Customer Support Services.
    --Code that doesn’t fry the optimizing engine:
    DECLARE @t_Asset TABLE
    (Asset_Id INT)
    INSERT INTO @t_Asset (Asset_Id) VALUES (1)
    INSERT INTO @t_Asset (Asset_Id) VALUES (2)
    INSERT INTO @t_Asset (Asset_Id) VALUES (3)
    DECLARE @Record_id INT
    ,@File_id NVARCHAR(MAX)
    ,@SKP_Cust_id NVARCHAR(MAX)
    ,@Unique_Barcode NVARCHAR(MAX)
    SELECT @Record_Id = (SELECT TOP 1 Asset_Id FROM @t_Asset)
    SELECT @file_id = (SELECT LEFT(REPLACE(CAST(NEWID() AS NVARCHAR(50)), '-', ''), 10))
    SELECT @Unique_Barcode=(SELECT LEFT(REPLACE(CAST(NEWID() AS NVARCHAR(50)), '-', ''), 15))

  • Hihaving a query like that who has done the Transport? How can i trace who

    having a query like that who has done the Transport? How can i trace who has done the transport (Import).
    I have tried with following steps but unable to find the right person.
    1. Go to TMS and disply the appropriate queue.
    2. Select menu path: Goto>Import History.
    3. Select menu path: Edit> Dipaly More.
    4. This will give the the "User" column.
    But my problem is the transport has happened long back. is there any other way to find out old import request who has done the transport.
    Please someone help me out on this.

    Do this may it can help you.
    At the last step where you had given "diaplay more"
    do this inspite of that:
    Extras --> Personal Settings
    Check the option "Query Interval Time" and try again.
    Best of luck !!!

  • The query processor could not produce a query plan

    I'm getting this message:
    Msg 8624, Level 16, State 17, Line 1
    Internal Query Processor Error: The query processor could not produce a query plan. For more information, contact Customer Support Services.
    This is what I run
    ;WITH TableA AS
    SELECT 101 as A_ID
    ,TableB AS
    SELECT 1 as B_ID, 101 as B_A_ID , 'xxx' as B_Courses
    UNION ALL
    SELECT 2 , 101 , 'YYY'
    UNION ALL
    SELECT 3 , 101 , 'ZZZ'
    UNION ALL
    SELECT 4 , 102 , 'AAA'
    SELECT
    A_id
    ,x.x.value('(./text())[1]','varchar(500)') AS fieldX
    FROM
    TableA AS A
    OUTER APPLY
    -- CROSS APPLY
    (SELECT
    ',' + B_Courses
    FROM
    TableB AS B
    WHERE
    1=1
    AND B.B_A_ID = A.A_ID
    FOR XML PATH(''),TYPE
    ) x(x)
    With OUTER
    APPLY, I get the message shown above.
    With CROSS
    APPLY, everything works nicely.
    I resolve by adding in select this :
    STUFF((SELECT ','+B_Courses
    FROM
    TableB AS B
    WHERE
    B.B_A_ID = A.A_ID
    FOR XML PATH(''),TYPE).value('(./text())[1]' ,'VARCHAR(500)'),1,1,'')
    Tested on:
    Edition ProductVersion ProductLevel
    Express Edition 9.00.3042.00 SP2
    and
    Edition ProductVersion ProductLevel
    Developer Edition (64-bit) 11.0.2100.60 RTM
    Any idea way is this happening?
    Thanks

    Is the below working for you?
    ;WITH TableA AS
    SELECT 101 as A_ID
    ,TableB AS
    SELECT 1 as B_ID, 101 as B_A_ID , 'xxx' as B_Courses
    UNION ALL
    SELECT 2 , 101 , 'YYY'
    UNION ALL
    SELECT 3 , 101 , 'ZZZ'
    UNION ALL
    SELECT 4 , 102 , 'AAA'
    SELECT
    A_id
    -- ,x.x.value('(./text())[1]','varchar(500)') AS fieldX --Commented this part
    FROM
    TableA AS A
    OUTER APPLY
    -- CROSS APPLY
    (SELECT
    ',' + B_Courses
    FROM
    TableB AS B
    WHERE
    1=1
    AND B.B_A_ID = A.A_ID
    FOR XML PATH(''),TYPE
    ) x(x)

  • How to read the BI query from CRM system?

    Hi All,
    I have to read one BI query in CRM system. Can you please let me know how we can do that?.
    do we have any RFC present in BI system where I can pass the query name and get the result of the query in the CRM system?
    Kindly help.
    Also, do we need to make some configuration settings in CRM system to execute the BI query in CRM? If so, please let me know how we can do that?
    Regards,
    Vaibhav

    HI
    The People centic user interface is the user interface layer where the end user process the crm transactions etc.
    go to SE 80 transaction and select the application as BSP application becouse pcui is bsp based views. type crm_bsp_frame under the application field and you will get folders select the select.htm folder and right click on the mouse and click on test then you will get the popup window enter the crm system user id and password you will get the pcui floor plan for entire crm applications in the browser select the lead and opportunity transaction floor plan click on the new floor plan option. then the new popup window will open and finally you will see the lead transaction or opportunity transaction pcui view to work on . these pcui views url will inturn you can assign to the enterprise portal to log on to single sign on to EP and access the pcui application for crm marketing sales and service module areas as well along with the contact and account mangement for business partners creation screen.
    please do reward points if helpful
    Dinaker vikas

  • Read the characteristics of a planned order in APO

    how can we read the characteristics of a planned order in APO.What Function Module can be used for this?
    how can we manually schedule the order activities based on the characteristics. Can we use the function module 
    /SAPAPO/OM_ACT_SCHEDULE by copying and making some changes in it for this purpose?

    Hi,
    if there are any orders in your system with characteristics (in planning version 000) then this report will find them:
    report  get_char.
    data:
       ls_genp     type /sapapo/om_gen_params,
       lt_orderid  type /sapapo/om_orderid_tab,
       lt_char     type /sapapo/om_charact_val_tab.
    ls_genp-simversion = '000'.
    call function '/SAPAPO/OM_ORDER_GET_ALL'
      exporting
        is_gen_params = ls_genp
        iv_simsession = ''
      importing
        et_orders     = lt_orderid.
    call function '/SAPAPO/OM_ORDER_GET_DATA'
      exporting
        is_gen_params       = ls_genp
        iv_simsession       = ''
        it_order            = lt_orderid
      importing
        et_charact_val_acts = lt_char.
    Best regards
    Thomas

  • How can I read the trace data from Agilent(HP​)8510C in C++ using NI488.2 and PCI-GPIB ?

    Hello! I am trying to develop an application in C++ for measurements with Agilent(HP) 8510C network analyser using NI488.2 and National Instrument's PCI-GPIB card. In HPBASIC the trace data is read using OUTPDATA command which contains PREAMBLE, SIZE and then the data string in real and imaginary pair for the required points. The ibrd function gives data only for one point. Kindly guide me how I can read the whole trace and and separate out the real and imaginary data values. Regards, kapil

    Hey Kapil,
    It seems that in HPBASIC you were using an instrument driver for the 8510C. OUTPDATA is not a native HPBASIC function. National Instrument has similar instrument drivers for LabVIEW and CVI.
    http://zone.ni.com/idnet97.nsf/9b2b33e1993d8777862​56436006ec498/7b235254f3881ddb862568ab005fbd2e?Ope​nDocument
    http://zone.ni.com/idnet97.nsf/9b2b33e1993d8777862​56436006ec498/24ca7db880ab78ae862568ab005fbc0f?Ope​nDocument
    For example in the CVI instrument driver you will find a source file called hp8510.c. In the source code you will find a function called hp8510c_dataInRaw that sounds similar to the function that you described.
    Note that this example is designed for CVI, but it is possible that you could extract the information you need for C++. If
    you had a copy of CVI you could just add the files downloaded from the instrument driver to a project and then compile and run the project. It already contains a ready to run example that allows you to capture data and use your instrument.
    If you want try CVI you can download an evaluation copy on-line at http://ni.com/lwcvi/launch.htm.
    I hope this helps out,
    JoshuaP
    National Instruments

  • Query reading the data

    Hi  all,
    we are involved in a SAP BW Upgrade 7.0 --> 7.3.
    During the manual follow up steps,  we are trying to launch some  Bex query to test if all works fine.
    Some of this queries returns us the following  message:
    Query XXX reading the data;
    the extended message says:
    DiagnosisXXX
    You need to replace variable XXX from as a boolean value. It can therefore only have the values 0 and 1.
    Entering (MWKZ = , WAERS = , ...) under Currency/Unit is therefore not advisable. Only dimension = number is allowed.
    System Response
    The query cannot be generated and executed.
    Procedure
    Change the definition of the variables.1.
    Procedure for System Administration
    Our SAP BW System is Version 7.3 support package 10.
    We found just the note   1873747  that seems like our message error but, unfortunately, the note itself have been just released with our support package  (SAPKB73010).
    Anyone have an idea?
    Thx in advance
    Best regards
    Rino

    Hello all,
    Yes, I agree with Robert that with suppressing the message we can avoid the failure.
    But, If the message is 541, you might have skipped the data which it reads. Query which you have executed must be with missing data.
    If the message is "109 - No data was found", you can suppress it.
    If you want to correct the 541 message either you have to reduce the selections of query or you should increase the memory elements.
    Please correct me if I am wrong.
    Thanks,
    Bharadhwaz

  • VC 7.1 SP05 unspecified error - how to read the debug trace?

    Hello,
    I am trying to consume a enterprise service with VC 7.1 SP05.
    Beforehand, I have tested the parameters using WSADMIN, and I know what I have to pass.
    Unfortunately, when feeding the same parameters to my VC model, I get a error message, and I cannot find out what is the problem. By reading the default trace, i cannot extract the relevant information.
    The error message I get from VC is:
    "Error occurred during Data Service, L_SRV Execution"
    The trace level is set to "debug", but as said, I am not able to find the relevant part in the trace file.
    Maybe someboy could teach me??
    Thanks,
    Dominik

    Hi,
    I just sent the trace file.
    The service has several inputs.
    https://wiki.sdn.sap.com/wiki/display/ESpackages/FindDemandPlanKeyFigureValueby+Elements
    I am passing parameters on the top level, and then using a data bridge, two more parameters one level below.
    Thanks,
    Dominik

Maybe you are looking for