Search code examples
sql-serversystem-views

I want to find column name in my database - is it possible?


My database name is CARE_DynamicsAX and I want to find a column name workerStatus


Solution

  • If I'm not wrong, you are trying to find the Table where you have a column name as workerStatus. If that is the case, you might run this query to find the same.

    This works for the column names from TABLES for SQL Server.

    This query would run under the assumption that you know that the column name that you are searching starts with workerStat

    SELECT c.name AS ColName, t.name AS TableName
    FROM sys.columns c
        JOIN sys.tables t ON c.object_id = t.object_id
    WHERE c.name LIKE 'workerStat%'