ascmd tool beta

I've just noticed Dave Wickert's post on the following thread on the Analysis Services MSDN forum, and thought I'd flag it up:
 
If you've ever wanted to be able to execute MDX or XMLA from the command line then you might want to sign up to be a beta tester for the tool he's co-developing. Here's a summary from the original post:
With it you can execute either an XMLA script or an MDX query. Input and output can come from either the command-line or files. It is called 'ascmd' and is patterned after sqlcmd's syntax and capabilities. Optionally you can as it to capture trace events  issued on the session (like SQL Profiler does). It runs over both tcp/ip connections and http access and it supports the new AS2K5 multi-instancing also.

I have started playing with xmla recently and a tool like the one above sounds like a really interesting way to do just xmla without having to load up SSMS.

If you can't wait or If you want an absolute bare bones way to issue an xmla query, one of the users on the above forum thread posted the following code.

Strangely enough there's no command line utility that executes XMLA scripts. Luckily it's easy to write one though. Here's a small C# program that does the job, XmlaExecutor.cs:

using System.IO;
using Microsoft.AnalysisServices.AdomdClient;

public class XmlaExecutor
{
   public static void Main(string[] args)
   {
      TextReader tr = File.OpenText(args[0]);
      string xmla = tr.ReadToEnd();
      tr.Close();
      AdomdConnection cn = new AdomdConnection("Data Source=localhost");
      cn.Open();
      AdomdCommand cmd = cn.CreateCommand();
      cmd.CommandText = xmla;
      cmd.ExecuteNonQuery();
      cn.Close();
   }
}


Compile it with:

csc /r:c:\Program Files\Microsoft.XML\Adomd.NET\90\Microsoft.AnalysisServices.AdomdClient.dll XmlaExecutor.cs

Then run it by saying:

XmlaExecutor myscript.xmla

Hope this helps!



Mattias Asplund

Print | posted on Wednesday, January 25, 2006 6:59 PM

Comments on this post

No comments posted yet.

Your comment:

 (will show your gravatar)