Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How To Register & Run MDX Query Using CLR Programing in SSAS Server (Assemblies)


How To Register & Run MDX Query Using CLR Programing in SSAS Server (Assemblies)

Author
Message
gopinathreddy.d
gopinathreddy.d
Grasshopper
Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)Grasshopper (13 reputation)

Group: General Forum Members
Points: 13 Visits: 126
I Have A Simple MDX Query
"Select [Measures].[Book Value GAAP USD] on COLUMNS From [Positions Cube]"
I Need To Run THis Query Using CLR Program (C# Code) and Register It In SSAS Server I Mean In Assemblies

I Tried SomeThing Like This .... Its Not Working (I am Pretty Much New To These Type Of Things)

using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using Microsoft.AnalysisServices;
using Microsoft.AnalysisServices.AdomdServer;
namespace BI.MDX
{
public sealed class BI_MDX_PosTrans_SP
{
public static float GAAPBV(float bv)
{
AdomdCommand objCommand;
string sConnString;
string strCommand;
AdomdConnection objConnection;


strCommand = "Select [Measures].[Book Value GAAP USD] on COLUMNS From [Positions Cube]";
sConnString = "Data Source=dev.bisqlas003.metlife.com;Initial Catalog=Inv_PosTrans";

AdomdConnection
objConnection.ConnectionString = sConnString;
objConnection.Open()


objCommand = new AdomdCommand(strCommand, objConnection);
objCellSet = objCommand.ExecuteCellSet();
SQLServerSteve
SQLServerSteve
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 250
Usually you would not hard-code the text of a query into CLR like this. In Analysis Services, you can only create CLR stored procedures - unlike in relational databases, where you can do CLR data types, triggers, aggregate, etc. You would call an Analysis Services stored procedure much like a function that operates on a row returned by a query, such as SELECT Column1, Column2, MyStoredProcedure(Column3), etc.

What you're trying do is much more like hard-coding the definition of a view, which isn't the usual use case. But if you really wanted to do that, you could use syntax like "CALL MyStoredProcedure." I was just writing a blog post the other day on how to do this with SQL Server Data Mining, but haven't posted it yet in my series at http://www.sqlservercentral.com/blogs/multidimensionalmayhem/2013/04/26/a-rickety-stairway-to-sql-server-data-mining-part-11-model-comparison-and-validation/. If you let me know the text of the errors you received, I might be able to help.

-- Steve
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search