DECLARE @tabel NVARCHAR(128)
SET @tabel= 'TABELINIMI'
SELECT sc.column_name, CAST(extended_properties.value AS NVARCHAR(1000)) AS [description]
FROM (
SELECT isc.column_name , c.[object_id], c.column_id
FROM information_schema.columns isc
INNER JOIN sys.columns c ON isc.column_name = c.name
AND OBJECT_NAME(c.object_id) = @tabel
AND isc.table_name = @tabel
AND OBJECTPROPERTY(c.object_id, 'IsMsShipped')=0
) sc
LEFT JOIN sys.extended_properties ON (sc.[object_id] = extended_properties.major_id AND sc.[column_id] = extended_properties.minor_id)
ORDER BY sc.column_name
Blogged with the Flock Browser