using, Tableau or Aginity I am trying to find all the Tables in Redshift Database that contain the string of word "Certified Service". Look online and so very long codes, as I am new to SQL I couldn't see what to replace in the code to adapt it to my query, and most codes seems to give me the error "Syntax error". I'm sorry for the repeated question, although most answers on here seem to be a few years old so not sure if anything as changed. Again I'm very new to SQL Thanks in advance
Asked
Active
Viewed 195 times
-2
-
Share your code so we can help you. – Amira Bedhiafi Mar 08 '21 at 16:10
-
I tried using the code found here:https://stackoverflow.com/questions/9185871/how-do-i-search-an-sql-server-database-for-a-string But I don't know what to change to adapt to my situation – Dorian Carlmikael Mar 08 '21 at 17:54
1 Answers
0
Try using following query to list all the table in Redshift, containing a specific text string
SELECT DISTINCT tablename FROM pg_table_def WHERE schemaname = 'public' and tablename ilike '%certified service%';
In case you want to search tbales with another sub-string, Replace certified services with your custom string and you'll get a list of all tables whose name contain that sub-string.

Nitish
- 968
- 6
- 9