Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Update query on MS SQL Server database using Alteryx

alt_tush
9 - Comet

HI,

 

I want want to update one SQL table using Alteryx.

I want to use following query to update the table:-

 

update table

set Column1 = "1"

where Column1 = "2"

 

i have created the DSN as well TEST_DB but i dont know how to implement the update query.

 

Could you please share the example or suggest.

 

Thank you in advance.

2 REPLIES 2
RolandSchubert
16 - Nebula
16 - Nebula

Hi @alt_tush ,

 

you can connect an Text Input tool with at least one column named like one column in your table (e.g.  [Column1]) with no records to an Output Data tool. In the Output Data tool, select the table you want to update and  "Append Existing" as Output Option. Use your update statement as  "Pre Create SQL Statement". The statement will be executed without adding or deleting any records.

 

Let me know if it works for you.

 

Best,

 

Roland

alt_tush
9 - Comet

Hi RolandSchubert,

Thank you for your prompt reply.

I tried as per your suggestion but it gives me error "primary key required for update option"

I tried with ODBC as well as OLEDB database connectivity but facing same error.

 

I tried with simple dummy table where only one column dummy and applied the update query but got an error

I used the following simple update query.

 

update [DATABASE].dbo.dummy
set [DATABASE].dbo.dummy.[dummy] = '1'
Where [DATABASE].dbo.dummy.[dummy] = '2'

 

Can you please help.

 

Thank you again 🙂

Labels
Top Solution Authors