I’m trying to execute a SQL job using T-SQL in my application on a SSAS cube. Here is what I have got so far:
public void UpdateCube()
{
AdomdConnection conn3 = new AdomdConnection("Data Source=BTN-SQL1;Initial Catalog=BTNTurboAnalysisServices;");
conn3.Open();
AdomdCommand cmd = conn3.CreateCommand();
cmd.CommandText = "EXEC [SalesAnalysis].sp_start_job N'Process BTN SSAS'; GO";
cmd.ExecuteNonQuery();
conn3.Close();
}
[SalesAnalysis] is the name of my cube and ‘Process BTN SSAS’ is the name of my SQL job.
The error I receive is:
Query (1, 6) Parser: The syntax for '[SalesAnalysis]' is incorrect.
Any help would be appreciate, thanks!
sp_start_job is a stored procedure in master.dbo
try
Also, as master.dbo.sp_start_job is a SQL stored procedure, you’ll need to use a SQL connection with ADO.NET (System.Database.SQLClient.SQLConnection) to kick it off, not ADOMD.
As sp_start_job just kicks off SQLAgent jobs, you’ll need to make sure it’s running as well.
There are some methods in ADOMD that allow you to process cubes, but I can’t recall them off the top of my head.
Something like