I had a table with non user friendly column names - I translated that to a view with decent column names
I wanted to easily add this to the extended properties
this is what I did:
DECLARE @sql nvarchar(max) select
@name = N''Translation'',
@value = N'''
@level0type = N''SCHEMA'', @level0name = dbo,
@level1type = N''TABLE'', @level1name = TARGET,
@level2type = N''COLUMN'', @level2name =' @sql = 'EXEC sys.sp_addextendedproperty + c.name + ''', + c2.name +';'from
(
select name ,column_idfrom sys.columns where
)
inner join (select name ,column_idfrom sys.columns where
)
on c2.column_id= c.column_id object_id =(select object_id('TARGET')) c2 object_id =(select object_id('SOURCE')) c
No comments:
Post a Comment