tracking a column in sql server database

  • hi...

    Could anyone help me out from this....

    I have a particular column say it as "xxxxxx" ,since there are nearly 2000 tables in a database.

    scanning all the tables and checking out for this column could take a lot of time to do.

    Is there any method or query that can be used to easily find out in which table this column exists,

    thanks in advanced

    jaya

  • select * from information_schema.columns where column_name='your search column name'

    Place Your search column name in condition and find your desire result.

  • jprabha.d (11/27/2009)


    Is there any method or query that can be used to easily find out in which table this column exists,

    Hi,

    Also use this,

    For search in the current database

    select object_name(id)TableName from syscolumns

    where name = ‘your string’

    For search in all database

    exec sp_MSforeachdb "select '?' As DatabaseName,object_name(id)TableName

    from ?.dbo.syscolumns where name = (‘your string’)"

  • arun.sas (11/28/2009)


    Hi,

    Also use this,

    For search in the current database

    select object_name(id)TableName from syscolumns

    where name = ‘your string’

    syscolumns is a deprecated system view and will be removed in a future version. Use sys.columns instead.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply