Showing posts with label xmla. Show all posts
Showing posts with label xmla. Show all posts

Monday, March 26, 2012

how to run XMLA file in C Sharp?

how to run XMLA file in C Sharp

You need to execute an AdomdCommand. In your C# project, you need to add reference to Microsoft.AnalysisServices.AdomdCleint. If you have a non query DDL (such as creating a mining structure), the following example will do the trick:

try

{

using (AdomdCommand cmd = conn.CreateCommand())

{

cmd.CommandText = DDL;

cmd.ExecuteNoQuery();

}

}

catch(Exception ..)

{

}

In the example, DDL is a string contains your XMLA script. If you are running a query, you may want to call cmd.ExecuteReader to obtain a data reader.

Cheers,

|||sorry, but with a XMLA file, i want to build another database in analysis service, and i get XMLA file from exists database, i want to run it from C# project to create new database on another computer, because i can't create data source or data DSV from statement?
With DDL as you say, my XMLA file to long to put in to C# project, if i put it in C# project, DDL will be in many rows, it will return error.
please explain for me clearly
thanks|||

Your DDL should be a string in C# like this:

string DDL;

and you can read your XMLA script from a XML file into this string. Or you can append your xmla script line by line like this:

StringBuilder DDLBuilder = new StringBuilder();

DDLBuilder.Append(" <Envelope xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\">");

DDLBuilder.Append("<Body>");

.....

DDLBuilder.Append("</Envelope>");

DDL = DDLBuilder.ToString();

Now you have you script in a string without put it in multiple lines. I hope this will help for your job.

Good luck,

Wednesday, March 21, 2012

How to run a xmla script from an SSIS package

I have a xmla script that adds an role to a SQL Server 2005 Analysis Service
s
database (see below). How do I run that from an SSIS package ? Is there a
specific SSIS task that will do it ?
Here's the script:
<Create xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<ParentObject>
<DatabaseID>Ask</DatabaseID>
</ParentObject>
<ObjectDefinition>
<Role xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ID>Role</ID>
<Name>REDPEPPER</Name>
<Members>
<Member>
<Name>Everyone</Name>
</Member>
</Members>
</Role>
</ObjectDefinition>
</Create>
Thanks,
CraigHello CraigHB,
There is an "Analysis Services Execute DDL" task which should do the trick
Darren Gosbell - SQL Server MVP
blog: http://geekswithblogs.net/darrengosbell

> I have a xmla script that adds an role to a SQL Server 2005 Analysis
> Services database (see below). How do I run that from an SSIS package
> ? Is there a specific SSIS task that will do it ?
> Here's the script: <Create
> xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
> <ParentObject> <DatabaseID>Ask</DatabaseID> </ParentObject>
> <ObjectDefinition> <Role xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ID>Role</ID>
> <Name>REDPEPPER</Name> <Members> <Member> <Name>Everyone</Name>
> </Member> </Members> </Role> </ObjectDefinition> </Create>
> Thanks, Craig
>

How to run a xmla script from an SSIS package

I have a xmla script that adds an role to a SQL Server 2005 Analysis Services
database (see below). How do I run that from an SSIS package ? Is there a
specific SSIS task that will do it ?
Here's the script:
<Create xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
<ParentObject>
<DatabaseID>Ask</DatabaseID>
</ParentObject>
<ObjectDefinition>
<Role xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ID>Role</ID>
<Name>REDPEPPER</Name>
<Members>
<Member>
<Name>Everyone</Name>
</Member>
</Members>
</Role>
</ObjectDefinition>
</Create>
Thanks,
Craig
Hello CraigHB,
There is an "Analysis Services Execute DDL" task which should do the trick
Darren Gosbell - SQL Server MVP
blog: http://geekswithblogs.net/darrengosbell

> I have a xmla script that adds an role to a SQL Server 2005 Analysis
> Services database (see below). How do I run that from an SSIS package
> ? Is there a specific SSIS task that will do it ?
> Here's the script: <Create
> xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
> <ParentObject> <DatabaseID>Ask</DatabaseID> </ParentObject>
> <ObjectDefinition> <Role xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ID>Role</ID>
> <Name>REDPEPPER</Name> <Members> <Member> <Name>Everyone</Name>
> </Member> </Members> </Role> </ObjectDefinition> </Create>
> Thanks, Craig
>
sql