In case you missed the announcement: Alteryx One is here, and so is the Spring Release! Learn more about these new and exciting releases here!

Alteryx Designer Desktop Discussions

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

Updating a field in a database

karlhansen
9 - Comet

I have successfully created a flow that updates the data in the flow.  I would like to write those changes back to my SQL Server database so I can track what has happened.

 

For instance, UPDATE mytable SET myfield = 1 WHERE keyfield = [keyfield].

 

Both the keyfield and the myfield are represented in a Formula that holds all the values in records as I need them (as verified in a Browse).  I send those records to an Output which is set to "Update; Warn on Update Failure", but all I get is an error that says "Primary Key required for Update option".

 

I would even settle for assigning a static value to myfield for each record identified by keyfield.

 

Does Alteryx write back to a database? 

Am I missing such a basic capability?

2 REPLIES 2
fmvizcaino
17 - Castor
17 - Castor

Hi @karlhansen ,

 

I'm not an expert, but I use to get that error when trying to update a table in a database. 

So, to use the Alteryx designed function of updating a database, you need to have a primary key defined in your database table in order to work.

 

Best,

Fernando V.

 

karlhansen
9 - Comet

As I looked further due to your suggestion, I found I had created an identity field, but not a primary key.  That has been changed, and, when tested, showed that the database update ran smoothly.  

 

Problem solved!  Thank you!

Labels
Top Solution Authors