Doing Inserts,Updates and Delete in Database tables using TI

Post Reply
User avatar
vinnusea
Posts: 116
Joined: Thu Sep 23, 2010 6:12 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2010
Location: San Diego ,CA

Doing Inserts,Updates and Delete in Database tables using TI

Post by vinnusea »

Hi Guys,
I have a excel source and using this with an ODBC and writing SQL query to pull data from Excel sheet and
My task is to do inserts update and delete a table present in SQL Server data base.
I have done lot of Inserts before using "ODBCOutput function" But how can i do Insert and update by comparing the columns?? like PK of Source is Null then Insert and if PK of target is null then delete and else compare each column with Target column and Update..

can you guys tell me any idea i can follow??

Thank you....
Thanks
Vinnusea
User avatar
Martin Ryan
Site Admin
Posts: 2003
Joined: Sat May 10, 2008 9:08 am
OLAP Product: TM1
Version: 10.1
Excel Version: 2010
Location: Wellington, New Zealand
Contact:

Re: Doing Inserts,Updates and Delete in Database tables usin

Post by Martin Ryan »

If I understand correctly what you're trying to do then you might find that you need several TI processes. The first will process the main table and then depending on what it finds in each row it will call other TI processes to do what it is you want to do. For example the Data tab of the first TI process, which reads from the main table, might look like this

Code: Select all

if(nData=someTest1);
  ExecuteProcess('DeleteRowProcess', 'pParm1', vVar1, 'pParm2', vVar2);
elseif(nData=someTest2);
  ExecuteProcess('UpdateRowProcess', 'pParm1', vVar3, 'pParm2', vVar4);
elseif(nData=someTest3);
  ExecuteProcess('InsertRowProcess', 'pParm1', vVar5, 'pParm2', vVar6);
else;
  SomeCatchAllCode;
endif;
HTH,
Martin
Please do not send technical questions via private message or email. Post them in the forum where you'll probably get a faster reply, and everyone can benefit from the answers.
Jodi Ryan Family Lawyer
Post Reply