0

I want to return all tables (or column names but the table itself is sufficient) that contain a certain string.

Right now I can list all column names = to something, but I don't know if I can find by value within the column.

SELECT     t.name,
           t.type_desc
FROM       dbo.[bigdatabase].sys.columns AS c
INNER JOIN sys.tables AS t
           ON c.object_id = t.object_id
WHERE      c.name = 'Language_name' 

Basically, I'm working with a huge database with a terrible data dictionary and terrible naming conventions. For this example, I have a query that finds the language someone speaks in the 'person' table from the 'Language_name' column. The 'Language_name' column returns a uniqueidentifier instead of the actual language name. I can't find the foreign key where the master would be to show what language this code translates to. I figure if I could search the database for columns this uniqueidentifier is also in I can find the master.

zdsnide
  • 51
  • 5
  • This question is answered here: https://stackoverflow.com/questions/436351/find-a-value-anywhere-in-a-database –  Apr 02 '19 at 21:00
  • 3
    Possible duplicate of [Find a value anywhere in a database](https://stackoverflow.com/questions/436351/find-a-value-anywhere-in-a-database) – Sebastian Brosch Apr 02 '19 at 21:06

0 Answers0