You are viewing limited content. For full access, please sign in.

Question

Question

Insert Data Activity Inserting Same Record

asked on December 17, 2014

I am wanting to use Workflow to pull information from a Progress database and Insert it into an MSSQL database. In the workflow I have the following setup:

I can test the "Query Skyward Employees" activity and it brings back the correct number of results. The "Delete Current Data in SQL1" also works correctly.

The problem is with the "Insert Employee Data Into SQL1" activity. It is inserting the same record into the database over and over again. The information is correct for that employee, I just need the other employees inserted. Any ideas on what may be causing this?

0 0

Answer

SELECTED ANSWER
replied on December 17, 2014

You're using the token from Query Data, which defaults to the first row. You would want to use the For Each Row token for the current values.

That said, this setup is inefficient as each iteration has to make and close a connection to SQL. It would be better to use a Custom Query activity to insert the results of the first query directly into the second table without bringing them into WF.

0 0
replied on December 17, 2014

Miruna, thank you for noticing that. I knew it was something simple. I will make the change.

As for the Custom Query, I am working on one, but will need some time to create it. For now I will just use this one and once I have tested the Custom Query I will switch it over. Thank you again for your input.

0 0
replied on December 19, 2014 Show version history

So I'm guessing that the Insert Data activity does a simple Insert Into statement like the following:

USE databaseName
INSERT INTO databaseTable(column1, column2, column3)
VALUES ('value1', 'value2', 'value3');

And I'm guessing that the custom query you are suggesting would use a structure similar to this:

USE databaseName;
INSERT INTO databaseTable
VALUES
         ('value1','value2','value3'),
         ('value1','value2','value3'),
         ('value1','value2','value3')

How do you use the above structure to iterate through the values from the initial query from the other database in Workflow?

0 0
replied on December 19, 2014

Not quite. See the link in my post above. It would be more like this (combining query data and insert data into one activity:

INSERT INTO table2
(column_name(s))
SELECT column_name(s)
FROM table1;

 

0 0
replied on December 19, 2014

So essentially I'm left with the Custom Query and Delete Query activities correct?

replied on January 7, 2015

How would this work in Workflow if the data is coming from two different databases since in Workflow you have to select the Data Source and Database up front?

0 0
replied on January 7, 2015 Show version history

If they're on the same server, prefixing the tables with the database and schema name will still work in Custom Query, provided that the user specified in the datasource configuration has rights to read from the first DB and write to the second one.

INSERT INTO [database1].[schema1].[table1]

(column_name(s))

SELECT column_names(s)

FROM [database2].[schema2].[table2]

 

0 0
replied on January 8, 2015

Unfortunetly they are on different servers. One is a Progress database and one is a MSSQL database.

0 0
replied on January 8, 2015

Progress or PostgreSQL?

You should be able to transfer data directly using the SQL built-in tools for data import. (I get the appeal of Workflow's UI wink, but this one of those cases where it is more efficient to use tools specifically built for that purpose)

 

0 0
replied on January 8, 2015

Progress OpenEdge is the database management system.

0 0
replied on January 8, 2015

It looks like they have ODBC drivers, so just using SQL's import data wizard should be fine. You can schedule imports there too and there are options for deleting the contents of the tables before each import.

1 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.