Exec SQL Server Jobs?

Post Reply
schlemiel29
Posts: 68
Joined: Tue May 08, 2012 8:29 am
OLAP Product: TM/1
Version: 11.8
Excel Version: Excel 365

Exec SQL Server Jobs?

Post by schlemiel29 »

Is it possible to execute a bunch of sql server jobs from TM1?
I think I can create a button connect to an TI process. In the Prolog I could call the sql server to execute all needed jobs before importing data.
But how should the code in the prolog look like? Any ideas?
tomok
MVP
Posts: 2836
Joined: Tue Feb 16, 2010 2:39 pm
OLAP Product: TM1, Palo
Version: Beginning of time thru 10.2
Excel Version: 2003-2007-2010-2013
Location: Atlanta, GA
Contact:

Re: Exec SQL Server Jobs?

Post by tomok »

Don't know what you mean by SQL "jobs". You can execute SQL stored procedures by just issuing the SQL against an open ODBC connection. If you mean some sort of WSH batch file, you can put the commands in a batch file which can be called from a TI process. Rather than re-create the wheel here just do a search in this site for batch files and TI. There are plenty of examples.
Tom O'Kelley - Manager Finance Systems
American Tower
http://www.onlinecourtreservations.com/
winsonlee
Regular Participant
Posts: 180
Joined: Thu Jul 01, 2010 3:06 am
OLAP Product: Cognos Express
Version: 9.5
Excel Version: 2007
Location: Melbourne, Australia

Re: Exec SQL Server Jobs?

Post by winsonlee »

Code: Select all

sqlcmd.exe
[{ { -U login_id [ -P password ] } | –E }]
[-S server_name [ \ instance_name ] ]
-Q"execute msdb.dbo.sp_startjob @job_name = 'PREPROD_ORA_POPULATE'"
You need to have the above code put in a batch file and run the batch file via the ExecuteCommand in the prolog.
rmackenzie
MVP
Posts: 733
Joined: Wed May 14, 2008 11:06 pm

Re: Exec SQL Server Jobs?

Post by rmackenzie »

schlemiel29 wrote:Is it possible to execute a bunch of sql server jobs from TM1?
I'm not sure whether tomok meant using ODBCOutput or the actual query in an ODBC TI. However, you can execute a stored procedure from the ODBCOutput command or the TI SQL query. For the former, check the ODBC functions
schlemiel29 wrote:I think I can create a button connect to an TI process. In the Prolog I could call the sql server to execute all needed jobs before importing data.
How would you account for any timing where you would need to wait for a stored procedure to complete, before you could import the data? If possible, you might want to rethink your strategy of having the call to the database initiated by the user, from an action button.
Robin Mackenzie
schlemiel29
Posts: 68
Joined: Tue May 08, 2012 8:29 am
OLAP Product: TM/1
Version: 11.8
Excel Version: Excel 365

Re: Exec SQL Server Jobs?

Post by schlemiel29 »

I'm new to SQl Server. In MS Access there are macros, which bundles queries to create tables, add data, delete data ... If these are similar to stored procedures, called by batch files, then yes this is a solution.
ExecuteCommand was named to do the job. And the last parameter is called "Wait" (got it from tm1 documentation). If i set this to 1, the process should return after completion. Isn't it?
So I could use this batch file with ExecuteCommand in the prolog. Or I'm wrong?
AlexanderZ
Posts: 6
Joined: Thu Apr 12, 2012 10:05 am
OLAP Product: TM1
Version: 10.1 10.2.1
Excel Version: 2007 2010

Re: Exec SQL Server Jobs?

Post by AlexanderZ »

There is another way to execute stored proc!
Just write on Prolog tab:

Code: Select all

ODBCOpen('sql_server', 'login', 'password');
ODBCOutput('sql_server', 'sqlquery');
ODBCClose('sql_server');
Regards,
Alexander Z.
Post Reply