IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

How to delete table content before mapping Options · View
chris928
Posted: Friday, November 20, 2009 12:28:48 AM
Rank: Newbie

Joined: 11/19/2009
Posts: 8
Location: Australia
Hi All,

A dumb question - how can I delete the content from a table before executing Insert action? I need to generate new content all the time and cannot figure out the settings for this.

Please, advise.

Thanks
island
Posted: Friday, November 20, 2009 6:07:07 AM
Rank: Newbie

Joined: 10/28/2002
Posts: 1,283
Location: AT
Hi,

there are no "settings" for this. You will have to execute an sql query to delete the contents of the table. You can write an sql query and execute it in the "Database query" tab of Mapforce, or in your database client (if you have one).



swremick
Posted: Wednesday, March 10, 2010 7:07:56 PM
Rank: Newbie

Joined: 3/10/2010
Posts: 4
Location: Northampton, Ma
Not a dumb question at all. I have been struggling with this for a few hours. Executing the SQL DELETE statements in the Database query is unfortunate, especially if your goal is to export this logic and execute from another source. It's too disconnected.

Any other options? I tried the Delete If on Database table options, but it does not provide the desired results of deleting EVERYTHING first.
eisl@addovation.com
Posted: Tuesday, March 23, 2010 10:41:54 AM
Rank: Newbie

Joined: 3/4/2010
Posts: 5
Location: Norway
I have handled this type of solution by creating a mapping that has the same table as both source and target using Delete If on Database table connecting all key fields.

Then when executing this from generated C# code I have to make my own console type application in order to make sure that this is the first mapping executed.
einsty
Posted: Sunday, January 9, 2011 2:14:05 AM
Rank: Newbie

Joined: 1/9/2011
Posts: 1
Location: Chicago
I've tried the route eisl suggested as well but was getting spotty results due to timeouts and it was a long running process anyway so not ideal.

Ultimately, the route I chose was to create a stored procedure in the database that cleaned the tables that needed to be cleaned and ran that from Mapforce. A few details...

1) the stored procedure had to return a result so after my "DELETE FROM" statements I just added a "SELECT 'Success' As Output

2) use a simple "EXEC sp_name" in the SELECT window inside MapForce and map the output to a logging table or xml file...whatever you like.

Oh, yes, and make sure that your user has execute permissions on the stored procedure you create.
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.