SELECT
sys.objects.name AS [Table Name],
sys.columns.name AS [Column Name],
sys.extended_properties.value AS [Description],
(select name +'('+CAST( sys.columns.max_length as varchar(20))+')' from sys.types t
where t.user_type_id=sys.columns.user_type_id)
FROM sys.extended_properties
LEFT OUTER JOIN sys.objects ON sys.extended_properties.major_id = sys.objects.object_id
LEFT OUTER JOIN sys.columns ON sys.extended_properties.major_id = sys.columns.object_id AND sys.extended_properties.minor_id = sys.columns.column_id
--WHERE sys.objects.name='tablo adı'
ORDER BY sys.objects.name, sys.columns.name
3 yorum:
Tek rakibin GOOGLE .Teşekkürler.
çok faydalı bir sql olmuş.
Eline sağlık
--en son bir düzeltme yaptım: alan büyüklüklerini hatalı getiriyor idi:
SELECT
sys.objects.name AS [Table Name],
sys.columns.name AS [Column Name],
sys.extended_properties.value AS [Description],
(select name +'('+CAST( sys.columns.max_length as varchar(20))+')' from sys.types t
where t.user_type_id=sys.columns.user_type_id)
FROM sys.extended_properties
LEFT OUTER JOIN sys.objects ON sys.extended_properties.major_id = sys.objects.object_id
LEFT OUTER JOIN sys.columns ON sys.extended_properties.major_id = sys.columns.object_id AND sys.extended_properties.minor_id = sys.columns.column_id
--WHERE sys.objects.name='tablo adı'
ORDER BY sys.objects.name, sys.columns.name
Yorum Gönder