community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
SOLVED

Insert or Update from Excel to SQL

Meteor

I am new to Alteryx and need to take a daily feed input file (excel) search for specified key to see if it already exists in a SQL Table.

If it already exists, i need to update the SQL Table.  Otherwise it will need a new record inserted into an existing table.

 

If anyone has already done something like this and willing/able to share with me how that was done, it would be appreciated so much. I'm just not sure how to start even though i did complete the learning in the academy section.  :(  Sorry - so your help is needed and appreciated.

 

Thank you in advance for your help and kindness

Alteryx
Alteryx

Hi @BuckeyeJane ,

 

Please see attached workflow as an example. It can be done In-DB for speed and simplicity.

 

1. Read SQL table

2. Join on ID

3. Change or update any common rows

4. Union them back

5. Push back to SQL table

 

Let me know if you have any more Qs.

 

Luke

Meteor

Thank you - That's exactly the information i was looking for..  

Meteor

 

1.  Is there a way to update only the Joined records in the SQL Table?  

2.  Is there a way to insert only the Records generated on the Right side of the Join (R)?

 

 

Seems like this is recreating the entire SQL Table.    Am i understanding this correctly? 

Meteor

1.  Is there a way to update only the Joined records in the SQL Table?  

2.  Is there a way to insert only the Records generated on the Right side of the Join (R)?

 

 

Seems like this is recreating the entire SQL Table.    Am i understanding this correctly? 

Alteryx
Alteryx

Yes, the simple solution above will require downloading the data and then fully overwriting the old table.

 

In order to achieve your two points below you can tinker with the configuration of the Output Data tool. In Row 3 of the options window - 'Output Options' - you will see you can Append, Update, Overwrite rows in the database. With this you can update the fields you want and then also append the new ones, likely in separate Outputs (from the Join and from the Right).

 

I recommend you experiment with these on a trial table in your DB.

 

Hope this helps,

 

Luke

Labels