|
|
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
|
|
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).
|
|
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.
|
|
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.
|
|
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.
|
|
|
guest |