Alteryx Designer Desktop Discussions

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

Check if table exists before writing to Microsoft Access table

leahpenelope
7 - Meteor

Hi all,

 

Hope to find a SQL+Access+Alteryx expert here 🙂

 

My workflow ends up with an Output file appending to tables in an Access database. The table names and contents are data-dependent (dynamic) and the table fields are the same for all tables.

 

If a table was not pre-set up in the Access database, the canvas will error out.

 

Is there a way to write a Pre Create SQL statement in the Output tool or even a Python tool prior to the Output tool that 

(a) checks if the table (table name in workflow) exists in the Access database

(b) if it exists, go ahead (and append data to that table)

(c) if it doesn't exist, create the table with table name and table fields from the workflow (followed by appending data to that table).

 

My table name is

TableA

 

My table fields are

From (V_String, size 255)

To (V_String, size 255)

Code (V_String, size 255)

Reference (V_String, size 255)

Message (V_String, size 255)

Message Type (V_String, size 255)

Create Time (V_String, size 255)

 

The primary key of the table may be generated by Access itself i.e. the id of each additional row is = id in previous row +1

 

Thanks!

0 REPLIES 0
Labels