0
I am trying to generate a data dictionary of my database in SQL Server 2017, and would like to recover the description/comment of the 'Description' field contained in the column definitions of each table. I was inspired by a code I found on a site, but I’m not able to add this table metadata.
Desired field:
SQL I am using:
SELECT
S.name as 'Schema',
T.name as Tabela,
C.name as Coluna,
TY.name as Tipo,
C.max_length as 'Tamanho Máximo', -- Tamanho em bytes, para nvarchar normalmente se divide este valor por 2
C.precision as 'Precisão', -- Para tipos numeric e decimal (tamanho)
C.scale as 'Escala' -- Para tipos numeric e decimal (números após a virgula)
FROM sys.columns C
INNER JOIN sys.tables T
ON T.object_id = C.object_id
INNER JOIN sys.types TY
ON TY.user_type_id = C.user_type_id
LEFT JOIN sys.schemas S
ON T.schema_id = S.schema_id
It worked!!! Thank you very much man, you are beast !!
– gabriellima