I'm looking for a way, using SQL, to see if a table exists for any random given name

I've tried creating a simple "Select * from MyRandomTableName" but this doesn't work in Marketing Cloud as i need to map the columns from the table to the DE i'm writing it and i can't be sure of the columnnames.

Is there any way, using SQL or any other way thay can be automated, to check if a table exists? I don't want the actual data, i just want to check if it can execute so i know the table with the given name exists.

for testing reasons i've been using the MC interface. Activties -> SQL queries and i've tried to create a statement that it would accept.

  • Can describe with more detail what you're trying to accomplish? – Adam Spriggs Feb 5 '19 at 12:25

Assuming you're working with the API, you'll have to do a retrieve of the target Data Extension first. If you're inserting a SQL Query, you'll get an error if it doesn't exist.

You always have to create the Data Extension first. The SQL Query activities do not originate Data Extensions.

|improve this answer|||||
  • I haven't used the API, only the website interface. I have created 2 data extensions. Test1 ( with several randomly named columns ) and Test2 ( with a single column named "Name" ). I don't care about getting the actual data. I only want to check if the table exists. If i could do "Select * from X" and see if it can be executed i know the table exists. – Timon Feb 5 '19 at 12:37
  • What's the use-case? It'd help to know why you need to know why a DE exists. – Adam Spriggs Feb 5 '19 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.