sql - Get column description after removing a field from table -
i need field description sql server 2012.
this query ok
select discription_table.value sys.extended_properties discription_table, information_schema.columns column_table column_table.table_name = 'users' , column_table.ordinal_position = discription_table.minor_id , column_table.column_name = 'login'
but if 1 of columns in table users removed after making description not working more.
reason ordinal_position not minor_id anymore.
how can fix it? management studio have problems this.
my solution: need use anther set of tables.
maybe "habit" , "old school", me solution more clear , more readable.
select extended_properties.value sys.schemas,sys.tables,sys.columns,sys.extended_properties schemas.schema_id = tables.schema_id , tables.object_id = columns.object_id , tables.object_id = extended_properties.major_id , columns.column_id = extended_properties.minor_id , tables.name='users' , columns.name='access_key'
thank everyone.
i believe you're after fn_listextendedproperty
example: info columns in table dbo.mytable
select objtype, objname, name, value fn_listextendedproperty(null, 'schema', 'dbo', 'table', 'mytable', 'column', null)
(going dig , add msdn link i'm sure out there somewhere, later) msdn docs here
to data specific column, replace last null
name (a non-existant column end in empty resultset, no errors).
Comments
Post a Comment