Find column name in ms sql server database

  By Junaid A   Posted on August-26-2022 

Find column name in ms sql server database


Sometime, we need modification in any column of ms sql server database table. we are unaware where is that column. we dont what is name of the table, where column is exist.


To find any column name you can use following ms sql server script.

        s.[name]            'Schema',
        t.[name]            'Table',
        c.[name]            'Column',
        d.[name]            'Data Type',
        c.[max_length]      'Length',
        d.[max_length]      'Max Length',
        d.[precision]       'Precision',
        c.[is_identity]     'Is Id',
        c.[is_nullable]     'Is Nullable',
        c.[is_computed]     'Is Computed',
        d.[is_user_defined] 'Is UserDefined',
        t.[modify_date]     'Date Modified',
        t.[create_date]     'Date created'
from        sys.schemas s

inner join  sys.tables  t

on s.schema_id = t.schema_id

inner join  sys.columns c

on t.object_id = c.object_id

inner join  sys.types   d

on c.user_type_id = d.user_type_id

where like '%Discount%'

By  asifjans    26-Aug-2022 Views  77


Your Comments

You may also read following recent articles