﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Integration Services / Data Warehousing  / Cannot use MDX WITH MEMBER statement in ADO NET source / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sun, 26 May 2013 20:58:01 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Cannot use MDX WITH MEMBER statement in ADO NET source</title><link>http://www.sqlservercentral.com/Forums/Topic1392566-364-1.aspx</link><description>Thanks, Mack. Actually I tried another non-script way, which contains couple of data conversions in data flow. ADONET Source -&amp;gt; Copy the column assigning a simple column name (For certain reason I could not use Derived column DFT to access [Measures].[WhateverTheMeasure]) -&amp;gt; Data Conversion (Convert To DT_WSTR) -&amp;gt; Data Conversion -&amp;gt;(Convert To DT_I4 or Whatever the finial variable type is) -&amp;gt;Recordset Destination (pick up the DT_I4 column and assign to a object variable), and then use foreach container to assign to your target variable. This method is a little trivial but easy to debug on the fly.</description><pubDate>Thu, 06 Dec 2012 07:14:30 GMT</pubDate><dc:creator>daifeng.hao</dc:creator></item><item><title>RE: Cannot use MDX WITH MEMBER statement in ADO NET source</title><link>http://www.sqlservercentral.com/Forums/Topic1392566-364-1.aspx</link><description>I have but I found the best way of doing this was to us a script component in the data flow  The issue I found with having MDX in SSIS package is that when the MDX returns 0 rows it tends to cause the package to fail.  This is because SSIS thinks it is returning less columns that it is expectingUsing a script component gets around thisMackSome sampe code[code="vb"]Imports SystemImports System.DataImports System.MathImports Microsoft.SqlServer.Dts.Pipeline.WrapperImports Microsoft.SqlServer.Dts.Runtime.WrapperImports Microsoft.AnalysisServices.AdomdClientImports Microsoft.AnalysisServicesImports System.Data.SqlClientImports AMO = Microsoft.AnalysisServices&amp;lt;Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute()&amp;gt; _&amp;lt;CLSCompliant(False)&amp;gt; _Public Class ScriptMain    Inherits UserComponent    Private cn As AdomdConnection    Private cmd As AdomdCommand    Dim CubeReader As AdomdDataReader    Public FinalMDX As String    Public Overrides Sub PreExecute()        MyBase.PreExecute()        'Dim CubeReader As AdomdDataReader        Dim Cmd As New AdomdCommand        cn = New AdomdConnection(Me.Connections.SSAS.ConnectionString)        cn.Open()        Cmd = New AdomdCommand()        Cmd.CommandType = CommandType.Text        FinalMDX = Me.Variables.MDXHeader.ToString &amp; Me.Variables.MDX.ToString        Cmd.CommandText = FinalMDX        Cmd.CommandTimeout = 0        Cmd.Connection = cn        CubeReader = Cmd.ExecuteReader()            End Sub    Public Overrides Sub CreateNewOutputRows()        Do While CubeReader.Read            With Output0Buffer                .AddRow()                .MyOutputColumn1 = CubeReader.GetValue(0)            End With        Loop        cn.Close()        CubeReader.Close()    End SubEnd Class[/code]</description><pubDate>Tue, 04 Dec 2012 14:32:41 GMT</pubDate><dc:creator>Mackers</dc:creator></item><item><title>RE: Cannot use MDX WITH MEMBER statement in ADO NET source</title><link>http://www.sqlservercentral.com/Forums/Topic1392566-364-1.aspx</link><description>Noticed an interesting result. I am using Execute SQL Task Editor with Analysis Service 10.0 as ole db provider. I assigned the returning result to an INT32 variable. However when I debug the package, I got null as returning result, while when I was running the query directly in management studio, I got 0. Then I switched the variable type to INT16 and it give me the correct result (0). It seems the AS will assign data type dynamically based on the returning result. Does anyone has any experience in handling MDX in SSIS?</description><pubDate>Tue, 04 Dec 2012 10:56:45 GMT</pubDate><dc:creator>daifeng.hao</dc:creator></item><item><title>Cannot use MDX WITH MEMBER statement in ADO NET source</title><link>http://www.sqlservercentral.com/Forums/Topic1392566-364-1.aspx</link><description>Hi, I tried the following MDX statement in ADO NET source but get a failure messageWITH MEMBER CountOfRows AS (   IIF(ISEMPTY(MEASURES.[Fact Test Result Count]), 0, MEASURES.[Fact Test Result Count]) ) SELECT CountOfRows ON 0 FROM [Fact Test Result] The error messag is Error: 0xC0209029 at Data Flow Task, ADO NET Source [87]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR.  The "component "ADO NET Source" (87)" failed because error code 0x80004002 occurred, and the error row disposition on "output column "[Measures].[CountOfRows]" (109)" specifies failure on error. An error occurred on the specified object of the specified component.  There may be error messages posted before this with more information about the failure.Error: 0xC02090F5 at Data Flow Task, ADO NET Source [87]: The component "ADO NET Source" (87) was unable to process the data. Pipeline component has returned HRESULT error code 0xC0209029 from a method call.Error: 0xC0047038 at Data Flow Task, SSIS.Pipeline: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  The PrimeOutput method on component "ADO NET Source" (87) returned error code 0xC02090F5.  The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.  There may be error messages posted before this with more information about the failure.However if I modify the above query toSELECT MEASURES.[Fact Test Result Count]) ON 0 FROM [Fact Test Result] I got no errors. Does that mean I can not use MDX WITH statement in ADO NET? Any walking around besides script task?</description><pubDate>Tue, 04 Dec 2012 09:14:53 GMT</pubDate><dc:creator>daifeng.hao</dc:creator></item></channel></rss>