Find column name in ms sql server database
Microsoft Net Framework

Find column name in ms sql server database


Problem

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.


Solution:

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


select  
        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 c.name like '%Discount%'

Share This with your friend by choosing any social account


Upcoming Articles
You may also read following recent Post
Copyright Future Minutes © 2015- 2024 All Rights Reserved.   Terms of Service  |   Privacy Policy |  Contact US|  Pages|  Whats new?
Update on: Dec 20 2023 05:10 PM