Answered Please help me..

  • Friday, April 27, 2012 11:13 AM
     
     

    I have 1 database.. in that database im having 20 tables.. my question is i have one column but i don't know that column belongs to which table..

    so how can i find that column belongs to which table?

All Replies

  • Friday, April 27, 2012 11:21 AM
     
     Answered

    Pls try this

    select Object_name(Object_ID) TableName,* from sys.columns where name ='ColumnName' ---Pls replace your column name 


    http://uk.linkedin.com/in/ramjaddu

    • Marked As Answer by Sagar129 Monday, April 30, 2012 6:32 AM
    •  
  • Friday, April 27, 2012 11:33 AM
     
     Proposed Answer Has Code
     or:
    select TABLE_SCHEMA, TABLE_NAME from information_schema.COLUMNS where COLUMN_NAME = 'mycolumnname'



    Thanks,

    Andrew Bainbridge
    SQL Server DBA

    Please click "Propose As Answer" if a post solves your problem, or "Vote As Helpful" if a post has been useful to you

  • Friday, April 27, 2012 7:15 PM
     
     

    Sagar129,

    There are some free tools that may help as well.  You can check out SQL Search by Red-Gate here: http://www.red-gate.com/products/sql-development/sql-search/