laxpro2001 laxpro2001 - 7 months ago 10
SQL Question

How can I look up column names in a SQL Server with an odd schema?

I'm trying to select column names in our database and I'm unsure how. I tried some solutions I found on Stack Social but I haven't been able to make them work.

Is it even possible given the schema? I feel like it should be but my limited understanding in how to change the FROM clause is preventing me from doing this on my own. Below is a picture to help elaborate on the difficulty I'm having.
Picture of schema and attempts to return table and column names

EDIT: The problem is unique in that the overall layout of our database seems largely different from the norm. There seems to be nested databases and I wasn't sure how to use a specific DB.

The Use function worked well for this but its not intuitive from other answers. At least the picture can help someone in the future if they have a similar problem.

Answer
Use RatManreport
GO

SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%CD%'